We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to apply themes for SfDigitalGauge?

This section tells you how to apply custom themes for WPF SfDigitalGauge. You can define custom styles for controls using Resource Dictionary that contains resources as well as styles for components.

C:\Users\labuser\Desktop\note.jpgNote: 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 Digital Gauge:

1. Create a WPF application and add SfDigitalGauge control as follows.

XAML

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 then click “Addbutton. Select “Resource Dictionary” by giving a name for the resource dictionary file (for example: MetroTheme.xaml). Add the necessary styles in the created resource dictionary as follows.

XAML

3. This resource dictionary is merged with the resources of application to share the custom styles defined for DigitalGauge.

XAML

Else, you can merge the resource dictionary in code-behind as follows.

WPF / Silverlight:

C#

 

WinRT:

C#

4. In result, the digital gauge is displayed with Metro style as follows.

D:\work_area\Gauge_WS\2014Volume3\WRT-3185\KBSample\Images\DigitalGauge_WPF.png

Figure 1: Metro Theme for Digital Gauge

You can define and apply any style or theme for digital 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.

Sample Link:

DigitalGaugeThemesDemo_WPF.zip

D:\work_area\Gauge_WS\2014Volume3\WRT-3185\KBSample\Images\DigitalGaugeThemes_WPF.png

Figure 2: Digital Gauge with various themes

Article ID: Published Date: Last Revised Date: Platform: Control:
2535 08/25/2014 08/25/2014 WPF SfDigitalGauge
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.