Skip to main content Skip to footer

How to Apply a C1Theme to a Custom Extended Control

You can apply a C1Theme to your application and it will apply to all ComponentOne and standard controls. However, if you’ve extended a control to provide your own custom version, the theme may not apply.

Follow these steps to apply a ComponentOne WPF Theme to your custom control.

1. Create style for your custom control inherited from C1DataGrid default style:
<UserControl.Resources>
        <my:ImageConverter x:Key="imageConverter"/>
        <Style TargetType="my:celsDataGrid" BasedOn="{StaticResource {x:Type c1:C1DataGrid}}"></Style>
 </UserControl.Resources>

2. Apply C1 theme as:

Dim theme As New C1ThemeC1Blue
C1Theme.ApplyTheme(Me, theme)
Application.Current.Resources.MergedDictionaries.Add(theme.GetNewResourceDictionary())