Table of Contents
Custom Skin/Theme for Your Own Control

EO.Wpf can extend theme support to non-EO controls. There are two ways to extend theme support to controls not provided by EO.Wpf:

  • Register the control with EO.Wpf.ThemeManager; - OR -
  • Monitor EO.Wpf theme/skin changes, then apply styles based on the current theme or skin of an EO.Wpf control;

This topic covers the first method. The second method is covered here.

In order for a control to support themes, you must first declare and register theme styles following steps described here, then register the control with EO.Wpf ThemeManager with the following code:

//Register a control with EO.Wpf.ThemeManager
ThemeManager.Register(control);

It is recommended that you call this code either inside the FrameworkElement's Initialized event handler, or overrides its OnInitialized method. For example:

public class CustomControl: BaseControl
{
    ....
    
    protected override void OnInitialized(EventArgs e)
    {
        //Register this control with EO.Wpf ThemeManager
        ThemeManager.Register(this);
        
        base.OnInitialized(e);
    }
    
    ....
}

Once the control is registered with the ThemeManager, the ThemeManager will automatically switches style for the control based on the value of ThemeManager.ThemeName or ThemeManager.SkinName attached property.