Ultimate Infragistics WPF Line of Business Applications Theming – Live Styling by the End-User At Runtime

Kiril Matev / Tuesday, September 28, 2010

In two past blog posts about theming Infragistics NetAdvantage for WPF Line of Business  applications, I presented theming using the resource washing approach (here and here). This type of theming enables the developer to quickly specify theming settings at compile time. Although this approach to theming is very simple to setup, it is not very flexible in that the theme remains unchanged during the execution of the application. In order to restyle, you’d have to change the theming settings in the XAML code, recompile and redeploy your application, which makes re-theming a long process which requires developer intervention.

The live theming approach described and implemented in the sample project in this post allows you to offer your users the capability to style your entire application in the color scheme of their choice at runtime. This approach has been implemented in its entirety, so you can readily reuse it in your existing applications, with no considerable effort on your side.

Running the Sample Project

The sample project consists of two forms, which feature all NetAdvantage for WPF Line of Business controls that can be themed using resource-washing, and the theming manager. Please run the sample project, experiment with the settings of the theming manager, and observe how they affect the appearance of NetAdvantage for WPF Line of Business controls. 

 

Theming Manager

The sample project implements the live resource washing in a theming manager, which allows the user to select the theme to be used, the type of resource washing, and the color to wash the theme with. As the code is available, you can customize how the user can specify the theming, for example use default wash mode, or allow the user to select from a range of pre-approved colors. Here’s a screenshot of the theming manager – its simple UI allows you to customize its appearance and extend it to save user selections into user themes, for example:

Live Theming Under the Hood

The live theming approach used by the theming manager uses the resource washing described in the two past posts on theming. However, once a user selects a different theming settings, the existing theming resource dictionaries for all NetAdvantage for WPF Line of Business controls are replaced with new theming resource dictionaries containing the settings provided by the user.

Summary

Using the live resource washing, you can allow your users to quickly restyle the entire application at runtime. This capability is provided by the ThemingManager class in the sample application, which you can readily reuse in your applications, or modify to fit your requirements. Adding live theming to your applications will liberate your users from standard color schemes, allow them to make your application more appealing, and ultimately enhance the value of your solution.