@@ -19,6 +19,22 @@ namespace Common.Converter
1919 /// <seealso cref="System.Windows.Data.IValueConverter" />
2020 public class ActiveToColorConverter : IValueConverter
2121 {
22+ /// <summary>
23+ /// Gets or sets the active brush.
24+ /// </summary>
25+ /// <value>
26+ /// The active brush.
27+ /// </value>
28+ public Brush ActiveBrush { get ; set ; } = new SolidColorBrush ( Color . FromRgb ( 255 , 215 , 0 ) ) ;
29+
30+ /// <summary>
31+ /// Gets or sets the inactive brush.
32+ /// </summary>
33+ /// <value>
34+ /// The inactive brush.
35+ /// </value>
36+ public Brush InactiveBrush { get ; set ; } = new SolidColorBrush ( Color . FromRgb ( 60 , 60 , 60 ) ) ;
37+
2238 /// <summary>
2339 /// Converts a value.
2440 /// </summary>
@@ -33,9 +49,9 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
3349 {
3450 if ( value is bool isActive && isActive )
3551 {
36- return new SolidColorBrush ( Color . FromRgb ( 255 , 215 , 0 ) ) ; // Gold for Active
52+ return ActiveBrush ; // Gold for Active
3753 }
38- return new SolidColorBrush ( Color . FromRgb ( 60 , 60 , 60 ) ) ; // Dark Gray for Inactive
54+ return InactiveBrush ; // Dark Gray for Inactive
3955 }
4056
4157 /// <summary>
@@ -52,17 +68,14 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
5268 {
5369 if ( value is SolidColorBrush brush )
5470 {
55- var color = brush . Color ;
56- if ( color == Color . FromRgb ( 255 , 215 , 0 ) ) // Gold
57- {
71+ if ( ActiveBrush is SolidColorBrush active && brush . Color == active . Color )
5872 return true ;
59- }
60- if ( color == Color . FromRgb ( 60 , 60 , 60 ) ) // Dark Gray
61- {
73+
74+ if ( InactiveBrush is SolidColorBrush inactive && brush . Color == inactive . Color )
6275 return false ;
63- }
6476 }
65- return false ;
77+
78+ return Binding . DoNothing ;
6679 }
6780 }
6881}
0 commit comments