This section tells you how to apply custom themes for WPF SfLinearGauge. You can define custom styles for controls using Resource Dictionary that contains resources as well as styles for components.
Note: Implementation and APIs are similar in WPF, Silverlight and WinRT Platforms. You can refer this article for other platforms too.
Steps to apply themes for Linear Gauge:
1. Create a WPF application and add SfLinearGauge control as follows.
2. To specify the styles for required controls, add a resource dictionary in the application. To add a resource dictionary, right-click on the WPF project and click “Add” button. Select “Resource Dictionary” by giving a name for the resource dictionary file (for example: MetroTheme.xaml). Then add the necessary styles in the created resource dictionary as follows.
3. This resource dictionary is merged with the resources of application to share the custom styles defined for LinearScale, LinearPointer and LinearRange.
Else, you can merge the resource dictionary in code-behind as follows.
WPF / Silverlight:
4. In result, linear gauge is displayed with Metro style as follows.
Figure 1: Metro Theme for Linear Gauge
You can define and apply any style or theme for linear gauge. To achieve this requirement, a sample containing 7 different themes like Metro, Blend, Almond, Sandune, Office Blue, Office Black and Office Silver is defined and attached in the following sample link for reference.
Figure 2: Linear Gauge with various themes
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|