Browse Source

ColorToSolidColorBrushConverter: implemented ConvertBack method. Although not used in the toolkit, a user has requested this functionaltiy and provided a patch.

pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
c77febf480
  1. 27
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Core/Converters/ColorToSolidColorBrushConverter.cs

27
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/Core/Converters/ColorToSolidColorBrushConverter.cs

@ -8,6 +8,16 @@ namespace Microsoft.Windows.Controls.Core.Converters
{
#region IValueConverter Members
/// <summary>
/// Converts a Color to a SolidColorBrush.
/// </summary>
/// <param name="value">The Color produced by the binding source.</param>
/// <param name="targetType">The type of the binding target property.</param>
/// <param name="parameter">The converter parameter to use.</param>
/// <param name="culture">The culture to use in the converter.</param>
/// <returns>
/// A converted SolidColorBrush. If the method returns null, the valid null value is used.
/// </returns>
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value != null)
@ -16,9 +26,24 @@ namespace Microsoft.Windows.Controls.Core.Converters
return value;
}
/// <summary>
/// Converts a SolidColorBrush to a Color.
/// </summary>
/// <remarks>Currently not used in toolkit, but provided for developer use in their own projects</remarks>
/// <param name="value">The SolidColorBrush that is produced by the binding target.</param>
/// <param name="targetType">The type to convert to.</param>
/// <param name="parameter">The converter parameter to use.</param>
/// <param name="culture">The culture to use in the converter.</param>
/// <returns>
/// A converted value. If the method returns null, the valid null value is used.
/// </returns>
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
if (value != null)
return ((SolidColorBrush)value).Color;
return value;
}
#endregion

Loading…
Cancel
Save