Theming Multiple Infragistics WPF Controls At Runtime

All too often you’d like to give your users a way to theme your applications at runtime. Theming entire screens containing multiple Infragistics NetAdvantage WPF LIne of Business controls is easy to implement and could be a valuable addition to your applications. It involves setting the value of the Theme property to the currently set theme on the application level.

Sample Project

The approach is implemented in a sample project, which is available here. It is built using Visual Studio 2010 and Infragistics NetAdvantage for WPF Line of Business 10.3 (a free 30-day trial is available). The download package contains trial versions of the libraries, so you can build and run it immediately. Here're a couple of screenshots showing how two windows containing a variety of Infragistics WPF LOB controls are themed using the DropDown in the main window.

The Approach

For all Infragistics WPF Line of Business controls that you’d like to theme, you need to set their Theme property to “[Current]”. This will bind their Theme property to the ThemeManager CurrentTheme property.

You can then set the CurrentTheme property of the ThemeManager to change the theme applied to all controls in the application. For example the statement below will cause all Infragistics WPF Line of Business controls to be themed using the Office 2007 Black theme:

ThemeManager.CurrentTheme=”Office2k7Black”;

In the sample, we control the theme used using a DropDown control, which is populated with the list of themes available in the ThemeManager using its GetThemes method.

Summary

Allowing your end-users to theme your application increases its usability as it enables your users to set the appearance they’re most comfortable with. As you can see, with a very small number of changes you can enable that and deliver a flexible theming in your applications using Infragistics WPF Line of Business controls.

If you have any questions, please email me at kmatev@infragistics.com


Comments  (1 )

mdperini
on Wed, Oct 2 2013 4:18 PM

Hi Kiril Matev,

Thank you posting this sample.

In Infragistics 13.1 the XamTileManager does not have a Theme attribute.

Can you update the sample project so that the XamTileManager's Theme can be updated at Runtime?

Thanks,

Michael Perini

Add a Comment

Please Login or Register to add a comment.