Skip to main content
All docs

GaugeContext Class

Provides a connection between data item containers from the Gauges section and underlying control’s gauges.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v23.1.Win.dll

NuGet Packages: DevExpress.Win.Dashboard, DevExpress.Win.Dashboard.Design


public class GaugeContext :


A gauge context provides the connection between dashboard data item containers from the Gauges section and the underlying control’s elements (gauge elements, or gauges). The GetDashboardItemGauge method returns Gauge that corresponds to the specified gauge element. The GetControlGauges method, in turn, gets a collection of gauge elements (the CircularGauge or LinearGauge objects) that corresponds to the specified Gauge.

For example, the Gauge dashboard item has two data item containers (the Gauges section): Extended Price and Quantity. The OrderDate (Year) series contains three values: 2014, 2015, and 2016. The image below shows the Gauge’s elements that are used to define context:


When you pass the Extended Price data item container as the GetControlGauges method parameter, you get a collection of CircularGauge or LinearGauge elements that corresponds 2014, 2015, and 2016 values in return:

On the contrary, if you pass one of the CircularGauge or LinearGauge objects as the GetDashboardItemGauge method parameter, you get a Gauge object that corresponds to the opened data layer in the selected Gauge dashboard item:

The following code shows how to paint the tickmark text for circular gauges to red. The DashboardDesigner.DashboardItemControlUpdated event is used to update the Gauge’s appearance.

using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using DevExpress.XtraGauges.Core.Drawing;
using DevExpress.XtraGauges.Win.Gauges.Circular;

// ...

private void DashboardDesigner1_DashboardItemControlUpdated(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e) {
    if(e.GaugeControl != null) {
        DashboardDesigner designer = (DashboardDesigner)sender;
        var gaugeDashboardItem = designer.Dashboard.Items[e.DashboardItemName] as GaugeDashboardItem;
        foreach(var dashGaugeElement in gaugeDashboardItem.Gauges) {
            var gaugeCollection = e.GaugeContext.GetGaugeControlGauges(dashGaugeElement);
            if(gaugeCollection != null) {
                for(int i = 0; i < gaugeCollection.Count; i++) {
                    CircularGauge gauge = gaugeCollection[i] as CircularGauge;
                    if(gauge != null)
                        gauge.Scales[0].AppearanceTickmarkText.TextBrush = new SolidBrushObject(Color.Red);


See Also