Sparkline supports built-in ComponentOne themes available in C1.WPF.Theming library. You can apply any of the available C1 themes to the Sparkline control and provide a customized and consistent appearance to the application.
The following steps illustrate how to apply C1 themes to Sparkline. This example uses the sample created in the Quick start.
Add the following assembly references to your application.
Create a class named MyTheme to return an object of the C1Themes class.
C# |
Copy Code
|
---|---|
public class MyThemes { private static C1Theme _myTheme = null; public static C1Theme MyTheme { get { if (_myTheme == null) { _myTheme = new C1ThemeShinyBlue(); } return _myTheme; } } } |
Subscribe to the Sparkline_Loaded event and add the following code to the Sparkline_Loaded event handler to apply the theme to the Sparkline control.
C# |
Copy Code
|
---|---|
//Apply C1 theme to Sparkline
C1Theme.ApplyTheme(sparkline, MyThemes.MyTheme);
|