Having trouble getting help?
Contact Support
Contact Support
Switching between light theme and dark theme
Refer to the following example code to switch between light and dark themes in Syncfusion® Maui controls.
void UpdateTheme(object sender, System.EventArgs e)
{
ICollection<ResourceDictionary> mergedDictionaries = Application.Current.Resources.MergedDictionaries;
if (mergedDictionaries != null)
{
var theme = mergedDictionaries.OfType<SyncfusionThemeResourceDictionary>().FirstOrDefault();
if (theme != null)
{
if (theme.VisualTheme is SfVisuals.MaterialDark)
{
theme.VisualTheme = SfVisuals.MaterialLight;
}
else
{
theme.VisualTheme = SfVisuals.MaterialDark;
}
}
}
}
The complete theme switch sample is available in this link.