|
1 | | -# Switching-between-light-and-dark-themes-in-.NET-Maui-SB |
2 | | -Contains samples for switching-between-light-theme-and-dark-theme in .NET Maui SB. |
| 1 | +# Applying Themes in Maui Controls |
| 2 | + |
| 3 | +Syncfusion themes allow you to apply colors across all the Syncfusion controls with a uniform approach and provide a consistent look and feel to your applications. This section covers the following topics: |
| 4 | + |
| 5 | +* Applying light and dark themes |
| 6 | +* Overriding the default theme |
| 7 | +* Creating your own theme |
| 8 | + |
| 9 | +## Applying light and dark themes |
| 10 | + |
| 11 | +By default, Syncfusion offers support for both light and dark themes through the inclusion of a [SyncfusionThemeResourceDictionary](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Themes.SyncfusionThemeResourceDictionary.html). |
| 12 | + |
| 13 | +To apply themes to your application, merge the [SyncfusionThemeResourceDictionary](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Themes.SyncfusionThemeResourceDictionary.html) item. |
| 14 | + |
| 15 | +#### Theme resource dictionary |
| 16 | + |
| 17 | +This resource dictionary includes keys and their corresponding color codes for all Syncfusion controls. Additionally, it contains the [VisualTheme](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Themes.SyncfusionThemeResourceDictionary.html#Syncfusion_Maui_Themes_SyncfusionThemeResourceDictionary_VisualTheme) property where we can declare the following two theme color values: |
| 18 | + |
| 19 | +1. MaterialLight |
| 20 | +2. MaterialDark |
| 21 | + |
| 22 | +#### Automatic merging |
| 23 | + |
| 24 | +When using more number of Syncfusion controls in an application, to make the process easier for merging the control style dictionaries of the controls, the [SyncfusionThemeResourceDictionary](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Themes.SyncfusionThemeResourceDictionary.html) class has been provided for automatic merging. |
| 25 | + |
| 26 | +{% highlight xaml %} |
| 27 | + |
| 28 | +<Application xmlns:base="clr-namespace:SampleBrowser.Maui.Base;assembly=SampleBrowser.Maui.Base" |
| 29 | + xmlns:syncTheme="clr-namespace:Syncfusion.Maui.Themes;assembly=Syncfusion.Maui.Core" |
| 30 | + x:Class="SampleBrowser.Maui.App" |
| 31 | + ...> |
| 32 | +<Application.Resources> |
| 33 | + <ResourceDictionary> |
| 34 | + <ResourceDictionary.MergedDictionaries> |
| 35 | + <!-- Theme resource dictionary --> |
| 36 | + <syncTheme:SyncfusionThemeResourceDictionary VisualTheme="MaterialDark"/> |
| 37 | + </ResourceDictionary.MergedDictionaries> |
| 38 | + </ResourceDictionary> |
| 39 | +</Application.Resources> |
| 40 | + |
| 41 | +.... |
| 42 | + |
| 43 | +</Application> |
| 44 | + |
| 45 | +{% endhighlight %} |
| 46 | + |
0 commit comments