21 lines
640 B
C#
21 lines
640 B
C#
|
|
using System.Globalization;
|
|||
|
|
using System.Windows.Data;
|
|||
|
|
using System.Windows.Media;
|
|||
|
|
|
|||
|
|
namespace ShrlAlgoToolkit.Mvvm.Converters;
|
|||
|
|
|
|||
|
|
public class ColorToBrushConverter: IValueConverter
|
|||
|
|
{
|
|||
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
//var color = (SelectedColor)value;
|
|||
|
|
if (value is System.Windows.Media.Color color)
|
|||
|
|
{
|
|||
|
|
return new SolidColorBrush(color);
|
|||
|
|
}
|
|||
|
|
return Binding.DoNothing;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|||
|
|
{ throw new NotImplementedException(); }
|
|||
|
|
}
|