WPF Styles Templates Skins and Themes


One of the biggest and most important features of WPF is its ability to give the user interface a radically different look, but still retain the “feel” or functionality. According to Adam Nathan in his book WPF 4.5 Unleashed by Sams publishing in chapter 14 on page 415, there are four main components of WPF’s restyling support:

  • Styles
  • Templates
  • Skins
  • Themes

Styles

A style is a simple way of separating property values from user interface elements. It is similar to the way we separate the CSS from the HTML. Styles are also the foundation for applying the other three mechanisisms: templates, skins and themes.

Interestingly, Triggers have a collection of Setters just like styles, but a style applies its values unconditionally, a trigger applies its style(s) based on one or more conditions.

Templates

These are powerful objects that many people are referring to when they speak about restyling in WPF.

Skins

Application-specific collections of styles and/or templates, often with the ability to be replaced dynamically (by the user when the program is running).

Themes

Visual characteristics of the operating system, with potential customizations by the end-user.