/// <summary> /// Sets color for attribute's value. /// </summary> /// <param name="value"> /// Attribute's value. /// </param> /// <param name="newColor"> /// The new color. /// </param> public void SetAttributeValueColor(object value, Color newColor) { string strValue = value == null ? string.Empty : value.ToString(); Color defaultColor = GetDefaultColor(value); AttributeConfigurationChangeEventArgs args = new AttributeConfigurationChangeEventArgs(this, "Colors") { Color = newColor, Value = strValue }; if (!Colors.ContainsKey(strValue)) { if (newColor != defaultColor) { Colors.Add(strValue, CustomColorConverter.ColorToString(newColor)); RaisePropertyChanged(this, "Colors", args); } } else { if (newColor != defaultColor) { Colors[strValue] = CustomColorConverter.ColorToString(newColor); } else { Colors.Remove(strValue); } RaisePropertyChanged(this, "Colors", args); } }
/// <summary> /// The get extended configuration. /// </summary> /// <returns> /// The <see cref="List{AttributeExtendedConfiguration}"/>. /// </returns> public List<AttributeExtendedConfiguration> GetExtendedConfiguration() { List<AttributeExtendedConfiguration> result = new List<AttributeExtendedConfiguration>(); foreach (object value in Values) { string strValue = value == null ? string.Empty : value.ToString(); if (Visibility.ContainsKey(strValue) || Colors.ContainsKey(strValue)) { result.Add(new AttributeExtendedConfiguration { Value = strValue, Color = Colors.ContainsKey(strValue) ? Colors[strValue] : CustomColorConverter.ColorToString(GetDefaultColor(value)), Visibility = !Visibility.ContainsKey(strValue) }); } } return result; }
/// <summary> /// sets color of calendar state /// </summary> /// <param name="color">The color.</param> public void SetColor(Color color) { CalendarStateColor = CustomColorConverter.ColorToString(color); RaisePropertyChanged("Color"); }
/// <summary> /// Initializes a new instance of the <see cref="CalendarStateConfiguration" /> class. /// </summary> /// <param name="name">The name.</param> /// <param name="color">The color.</param> public CalendarStateConfiguration(string name, Color color) { IsVisible = true; Name = name; CalendarStateColor = CustomColorConverter.ColorToString(color); }