Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
Getting default labeltool foreground color
posted

Hello,

I have an issue setting the labeltool foreground color to its default (or set theme) value. I have a WPF application using lots of Infragistics components, applying the default theme on all Infragistics parts.

My main issue is how to find the correct brush in code behind in a value converter.

   public class PanelActiveConverter : IValueConverter
   {
       public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
       {
           if (value == null)
           {
               return Binding.DoNothing;
           }

           if (value is PanelListItem)
           {
               var p = value as PanelListItem;

               if (p.Active == false)
               {
                   return System.Windows.Media.Brushes.DarkRed;
               }
               else
               {
                   return System.Windows.Media.Brushes.Black;
               }
           }

           if (value is PanelData)
           {
               var p = value as PanelData;

               if (p.Active == false)
               {
                   return System.Windows.Media.Brushes.DarkRed;
               }
               else
               {
                   return System.Windows.Media.Brushes.Black;
               }
           }

           return Binding.DoNothing;
       }

       public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
       {
           return Binding.DoNothing;
       }
   }

I want to set the foreground brush of the control using this converter depending on the Active value. If false, I want it to be dark red, if not I want to use the default color for that control, wether it is the default theme or any set theme in the future.

All I can see so far, is that Infragistics applies a default theme and uses this on its control. How can I access this in code behind?

LabelTool is the primary control this applies to, but such as grid cell editor will also need the same type of handling.

Br

Fredrik Walka

Parents Reply Children
No Data