Common.Wpf.Themes

Contains Windows Desktop resources which can be includes in WPF .NET projects.

Getting Started

To include the resources in a WPF project:

  • Add a reference to the Common.Wpf.Resources assembly or package.

  • Include the required resource dictionaries in the App.xaml file.

The base theme resources are contained in a Common.xaml dictionary.
Default font details: Common.FontFamily, Common.FontSize
Border color brushes: Focus.Border, MouseOver.Border, and Validation.HasError
Styles and templates: commonEditBorderStyle, commonSmallTextBlockStyle, commonErrorItemTemplate, commonErrorItemsStyle, commonErrorTextBlockStyle

If you need to access any of these directly, and you don’t have the TextBox dictionary included, you will need to specify the following:

XAML
<ResourceDictionary>
  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="pack://application:,,,/Common.Wpf.Resources;component/Themes/Common.xaml"/>
  </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

How To

To override any of the default settings for a resource, you can create a custom style and base it on a Common style.
For example, to use 'adornment style' error messages for a Text Box:

XAML
<Style x:Key="errorTextBox1" TargetType="{x:Type TextBox}" BasedOn="{StaticResource commonTextBoxStyle}">
  <Setter Property="Validation.ErrorTemplate" Value="{StaticResource commonErrorItemTemplate}"/>
</Style>

Notes

Resource Dictionary Dependencies:

Resource Dictionary

Relies on

[Common.Wpf.Resources]

Themes/Button.xaml

Themes/CheckBox.xaml

Themes/Common.xaml

Themes/ListView.xaml

Themes/PasswordBox.xaml

Themes/Common.xaml

Themes/TabControl.xaml

Themes/Button.xaml

Themes/TextBox.xaml

Themes/Common.xaml

[Common.Wpf.Controls]

Themes/ComboBox.xaml

[Resources]/Themes/Common.xaml

Themes/DatePicker.xaml

[Resources]/Themes/Common.xaml

Themes/FilePathTextBox.xaml

[Resources]/Themes/Common.xaml
Themes/Toolbar.xaml

Themes/ModalDialog.xaml

Themes/NumericSpinner.xaml

[Resources]/Themes/Common.xaml
[Resources]/Themes/Button.xaml

Themes/SearchTextBox.xaml

[Resources]/Themes/Common.xaml
Themes/Toolbar.xaml

Themes/Toolbar.xaml

[Resources]/Themes/Button.xaml

See Also