/// <summary> /// Sets color for attribute's value. /// </summary> /// <param name="value">attribute's value.</param> /// <param name="isVisible">The _visibility.</param> public void SetAttributeValueVisibility(object value, bool isVisible) { // default value for visibility is true so there is no need to store true value string strValue = value == null ? string.Empty : value.ToString(); if (!Visibility.ContainsKey(strValue)) { if (!isVisible) { Visibility.Add(strValue, isVisible); } } else { if (isVisible) { Visibility.Remove(strValue); } else { Visibility[strValue] = false; } } // HACK AdvancedPropertyChangedEventArgs eventArgs = new AdvancedPropertyChangedEventArgs(this, "Visibility", new AttributeConfigurationChangeEventArgs(this, "Visibility") { Value = strValue, Visibility = isVisible }); RaisePropertyChanged(this, eventArgs); }
/// <summary> /// Gets color for attribute's value. /// </summary> /// <param name="value"> /// Attribute's value. /// </param> /// <returns> /// The color. /// </returns> public bool GetAttributeValueVisibility(object value) { string strValue = value == null ? string.Empty : value.ToString(); if (Visibility.ContainsKey(strValue)) { return Visibility[strValue]; } return true; }
/// <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; }