Back to Devexpress

GaugeExportContext Class

dashboard-devexpress-dot-dashboardcommon-6e1dd998.md

latest4.5 KB
Original Source

GaugeExportContext Class

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

Namespace : DevExpress.DashboardCommon

Assembly : DevExpress.Dashboard.v25.2.Core.dll

NuGet Package : DevExpress.Dashboard.Core

Declaration

csharp
public class GaugeExportContext :
    ControlContext
vb
Public Class GaugeExportContext
    Inherits ControlContext

The following members return GaugeExportContext objects:

Remarks

Use the XRDashboardGauge object to customize the printable gauges.

The following image illustrates elements of the printable gauge:

Example

The following example illustrates how to customize the Gauge dashboard item in the exported document when you handle the DashboardDesigner.CustomExport / DashboardViewer.CustomExport events. You can use the CustomExportEventArgs.GetPrintableControls method to obtained the printable controls.

csharp
using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;

private void DashboardControl_CustomExport(object sender, CustomExportEventArgs e) {
  foreach(var printControl in e.GetPrintableControls()) {
    if(printControl.Value is XRGaugeDashboardItem) {
      var gaugeItemName = printControl.Key;
      DashboardDesigner designer = (DashboardDesigner)sender;
      var gaugeDashboardItem = designer.Dashboard.Items[gaugeItemName] as GaugeDashboardItem;
      foreach(var dashGaugeElement in gaugeDashboardItem.Gauges) {
        foreach(var gaugePanel in e.GetGaugeContext(gaugeItemName).GetPrintableGauges(dashGaugeElement).Cast<XRDashboardGauge>()) {
          if(gaugePanel != null) {
              gaugePanel.MainSeriesLabel.ForeColor = Color.Red;
          }
        }
      }
    }
  }
}
vb
Imports DevExpress.DashboardCommon
Imports DevExpress.DashboardWin
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Windows.Forms

Private Sub DashboardControl_CustomExport(ByVal sender As Object, ByVal e As CustomExportEventArgs)
    For Each printControl In e.GetPrintableControls()
        If TypeOf printControl.Value Is XRGaugeDashboardItem Then
            Dim gaugeItemName = printControl.Key
            Dim designer As DashboardDesigner = CType(sender, DashboardDesigner)
            Dim gaugeDashboardItem = TryCast(designer.Dashboard.Items(gaugeItemName), GaugeDashboardItem)
            For Each dashGaugeElement In gaugeDashboardItem.Gauges
                For Each gaugePanel In e.GetGaugeContext(gaugeItemName).GetPrintableGauges(dashGaugeElement).Cast(Of XRDashboardGauge)()
                    If gaugePanel IsNot Nothing Then
                        gaugePanel.MainSeriesLabel.ForeColor = Color.Red
                    End If
                Next gaugePanel
            Next dashGaugeElement
        End If
    Next printControl
End Sub

Inheritance

Object ControlContext GaugeExportContext

See Also

GaugeExportContext Members

DevExpress.DashboardCommon Namespace