Hello,
users of my application can change the theme at runtime.How can I bind to theme specific brushes by XAMLlike it is possible with system colors using {DynamicResource {x:Static SystemColors.SomeBrushKey}}
Where can I find a list of available named brushes?
Thank you.
Hello J_Feuerstein,
Thank you for your post!
I have been looking into your question. You can see the default brushes from the default styles of the controls. There is a folder 'DefaultStyles', that you can find on your computer, under the following directory: C:\Program Files (x86)\Infragistics\2014.1\WPF\DefaultStyles.
There is a separate folder for the different controls.
For the XamDataPresenter, for example, there is a separate file, containing the brushes: "DataPresenterGeneric_Brushes.xaml". For other controls like XamDataTree, the brushes are in the 'generic.xaml' file.
Please do not hesitate to let me know if you have any further questions on this matter.
Hello Gergana,
thank you for the reply.When I understood correct, you gave me the hint where I can find the brush key names.
What I am missing is how to access the actual value of a particular named brush from the current theme. I need to access something like ThemeManager.CurrentTheme.GetBrush(ControlBackgroundBrush)
Very concrete I want to bind the background brush of an expander control to the current background brush of the XamDataGrid cell when hovered.
Thank you for any hint.
I have been looking into your post.
In case you are using the Infragistics themes(IGTheme, Metro, MetroDark, etc) the best approach I ca suggest is to use the implicit themes for the Microsoft controls, that we offer. You can find them in the Themes folder under the following directory: C:\Program Files (x86)\Infragistics\2014.1\WPF\Themes. There are 5 themes for the Microsoft controls, that can be used. For example if you use the IG Theme, when you open the IG folder you would be able to see files named IG.MSControls.Core.Implicit.xaml and IG.MSControls.Toolkit.Implicit.xaml.
If you are creating your own themes for the controls you can use a reflection to get the theme, that is applied to the XamDataGrid. Then the style for the DataRecordCellArea could be get and then you can get the Brush, that is used for the BackgroundHover property of the DataRecordCellArea.
I have created a small sample application for you to show you the second approach I have suggested. In the sample application I am applying the IGTheme, using the ThemeManager.CurrentTheme to the XamDataGrid. Also, in the sample I have a button and a label. On the Click event of the button I get the Theme, the style for the DataRecordCellArea. Then I apply the brush, used for the BackgroundHover property of the XamDataGrid to the Background property of the Label.
Please find the attached sample application and feel free to let me know if you have any further questions on this matter.
I am just checking if you have any further questions on this matter. Please do not hesitate to let me know if you do.