BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
x:Class="Chart_GettingStarted.DarkTheme">
<Color x:Key="SfChartAxisLineColor">White</Color>
<Color x:Key="SfChartMajorTickLineColor">White</Color>
<Color x:Key="SfChartAxisLabelColor">White</Color>
<Color x:Key="SfChartMajorGridLineColor">White</Color>
<Color x:Key="SfChartBackgroundColor">Black</Color>
<Color x:Key="backgroundColor">Yellow</Color>
<Color x:Key="color1">Red</Color>
<Color x:Key="color2">Blue</Color>
</ResourceDictionary> |
private void Button_Clicked(object sender, EventArgs e)
{
if (isLightTheme)
{
ICollection<ResourceDictionary> mergedDictionaries = this.Resources.MergedDictionaries;
var lightTheme = mergedDictionaries.OfType<LightTheme>().FirstOrDefault();
if (lightTheme != null)
{
mergedDictionaries.Remove(lightTheme);
}
mergedDictionaries.Add(new DarkTheme());
isLightTheme = false;
}
else
{
ICollection<ResourceDictionary> mergedDictionaries = this.Resources.MergedDictionaries;
var darkTheme = mergedDictionaries.OfType<DarkTheme>().FirstOrDefault();
if (darkTheme != null)
{
mergedDictionaries.Remove(darkTheme);
}
mergedDictionaries.Add(new LightTheme());
isLightTheme = true;
}
} |
<ContentPage.Resources>
<syncTheme:SyncfusionThemeDictionary>
<syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
<ResourceDictionary>
<x:String x:Key="SfChartTheme">CommonTheme</x:String>
</ResourceDictionary>
</syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
</syncTheme:SyncfusionThemeDictionary>
</ContentPage.Resources>
<chart:ChartDataMarker>
<chart:ChartDataMarker.LabelTemplate>
<DataTemplate>
<StackLayout BackgroundColor="{DynamicResource backgroundColor}" >
<Label Text="High" />
</StackLayout>
</DataTemplate>
</chart:ChartDataMarker.LabelTemplate>
</chart:ChartDataMarker> |