StyleHelper

The StyleHelper class has a few static members that will create style forwarders. Style forwarders are styles that are defined on the application level, not on the theme level. This allows you to create forwarders with the same key as the control name, but that will forward to the DefaultxxxStyle. Since the new styles are defined at the application level, you will not get any circular references because the style defined in the theme cannot access the application level resources.

This is accomplished by simply calling StyleHelper.CreateStyleForwardersForDefaultStyles() in the OnStartup of an application.

Catel currently ships with a several theme files. This example theme file is based on the “Aero" theme that is included in the WPF libraries. The theme of Catel corrects the margins, since the default “Aero" theme sets the margin of all controls to 0, which will result in all the user controls being stuck together, as shown in the figure below:

We see too many developers fixing the margins on the control directly, while this can also be accomplished by using the Catel theme and the included StyleHelper class. See the image below for the final result: