Themes for WinForms | ComponentOne
Themes for WinForms Quick Start / Apply Material Themes
In This Topic
    Apply Material Themes
    In This Topic

    To apply material theme in your application use the C1ThemeController as the following:

    1. Open a form belonging to your application in the Visual Studio's forms designer. In this example we will open a ComponentOne WinForms sample, SimpleTextEditor.
    2. From the designer's toolbox, drag a C1ThemeController and drop it on your form. (The C1ThemeController is provided by the C1.Win.C1Themes.4.5.2 assembly; if you don't see it in your toolbox you can add it manually).
      Note: Reference to C1.C1Zip.4.dll is required in a project that uses C1ThemeController.
      A ThemeController dialog box appears.

      theme-controller

    This enables you to select the application-wide default theme, the current controller’s default theme, and themes for all supporting controls already on the form. Note: The same dialog is also available via the Set Themes action on the C1ThemeController tasks menu.

    Initially in the dialog that pops up, the theme is specified as "(none)" for all supporting controls already on the form. This is done to prevent unintentional loss of property settings on those controls.

    1. Click the All to (default) button in the dialog so that the default theme is set on all controls. If case you have deliberately customized some of the controls already this will not need to be done.
       (When new controls are dropped on the form already containing a C1ThemeController component, theme is set to "(default)" on them automatically.)

    all-to-default

    1. Select the material theme from the list of available prebuilt themes. In our case, we have selected Material Dark theme from the list as shown in the image below.

      material-theme

    1. Click the All to (default) button as mentioned above, to set the default theme on all supporting controls on the form.
    2. Finally, click the OK button to close the dialog and apply the specified theme to the controls on the form.
    3. If your application contains multiple forms, repeat the steps above (with the exception of specifying the default ApplicationTheme as it will already be pre-selected for you) for all forms in your application.

    When you are done, the selected application theme will be applied to controls on your forms both at design and runtime.

    The following image illustrates the MaterialDark theme applied to the SimpleTextEditor application.

    apply-materialtheme