Pre loader

Apply theme to all SciChartSufaces

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies