ComponentOne DateTimeEditors for WPF
TimeEditor Overview / C1TimeEditor Theming
In This Topic
    C1TimeEditor Theming
    In This Topic

    TimeEditor for WPF incorporates several themes that allow you to customize the appearance of your controls. When you first add one of the C1TimeEditors controls to the page, they appear similar to the following image:

    Note: Themes are only supported in .NET Framework.

    But the C1TimeEditor control can also be themed with one of our thirteen included WPF themes: BureauBlack, C1Blue, ExpressionDark, ExpressionLight, Office2007Black, Office2007Blue, Office2007Silver, Office2010Black, Office2010Blue, Office2010Silver, ShinyBlue, and WhistlerBlue. The table below provides a sample of each theme:

    Theme Name

    Theme Preview

    BureauBlack

    C1Blue

    Cosmopolitan

    ExpressionDark

    ExpressionLight

    Office2007Black

    Office2007Blue

    Office2007Silver

    Office2010Black

    Office2010Blue

    Office2010Silver

    ShinyBlue

    WhistlerBlue

     

    To set an element's theme, use the ApplyTheme method. First add a reference to the theme assembly to your project, and then set the theme in code, like this:

    Visual Basic
    Copy Code
    Private Sub Window_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
       Dim theme As New C1ThemeExpressionDark
       ' Using ApplyTheme
       C1Theme.ApplyTheme(LayoutRoot, theme)
    

     

    Example Title
    Copy Code
    private void Window_Loaded(object sender, RoutedEventArgs e)
       {
          C1ThemeExpressionDark theme = new C1ThemeExpressionDark();
          //Using ApplyTheme
          C1Theme.ApplyTheme(LayoutRoot, theme);
       }
    

     

    To apply a theme to the entire application, use the System.Windows.ResourceDictionary.MergedDictionaries property. First add a reference to the theme assembly to your project, and then set the theme in code, like this:

    Visual Basic
    Copy Code
    Private Sub Window_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
       Dim theme As New C1ThemeExpressionDark
       ' Using Merged Dictionaries
    Application.Current.Resources.MergedDictionaries.Add(C1Theme.GetCurrentThemeResources(theme))
    End Sub
    

     

    C#
    Copy Code
    private void Window_Loaded(object sender, RoutedEventArgs e)
       {
          C1ThemeExpressionDark theme = new C1ThemeExpressionDark();
          //Using Merged Dictionaries      
          Application.Current.Resources.MergedDictionaries.Add(C1Theme.GetCurrentThemeResources(theme));
       }
    

    Note that this method works only when you apply a theme for the first time. If you want to switch to another ComponentOne theme, first remove the previous theme from Application.Current.Resources.MergedDictionaries.