2025-05-05 17:04:06 +08:00
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
|
2026-02-21 16:31:24 +08:00
|
|
|
|
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters;
|
2025-05-05 17:04:06 +08:00
|
|
|
|
|
2025-07-11 09:20:23 +08:00
|
|
|
|
public class ColorToBrushConverter : IValueConverter
|
2025-05-05 17:04:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
|
|
|
|
|
//var color = (SelectedColor)value;
|
2026-02-24 11:34:18 +08:00
|
|
|
|
if (value is Color color)
|
2025-05-05 17:04:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
return new SolidColorBrush(color);
|
|
|
|
|
|
}
|
|
|
|
|
|
return Binding.DoNothing;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{ throw new NotImplementedException(); }
|
|
|
|
|
|
}
|