SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

0
0

The ThemeManager has a SetTheme method that requires me to provide the dependency object of the thing I want to se the theme for. However, is there a way to set the theme in the ThemeManager and have it apply to all instances of SciChartSurfaces in the application?

Version
6.2.1
  • You must to post comments
0
0

Hi James

Yes of course, you can do this via implicit styles.

Try this:

<Style TargetType="s:SciChartSurface">
     <Setter Property="s:ThemeManager.Theme" Value="ExpressionDark"/>
</Style>

Put this code in your App.xaml or in a resource dictionary and it will be applied to all SciChartSurfaces in the application.

NOTE: There are sometimes caveats where implicit styles are not applied to dependency objects. You need to check that the style is applied and if not try another technique, to have a named style:

// Add this named style to App.xaml
<Style TargetType="s:SciChartSurface" x:Key="GlobalSciChartStyle">
     <Setter Property="s:ThemeManager.Theme" Value="ExpressionDark"/>
</Style>

// Then in your files
<s:SciChartSurface Style="{StaticResource GlobalSciChartStyle}">

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.