Back to Devexpress

DashboardControl.DashboardItemMouseUp Event

dashboard-devexpress-dot-dashboardwpf-dot-dashboardcontrol-a45c73f2.md

latest12.9 KB
Original Source

DashboardControl.DashboardItemMouseUp Event

Occurs when the mouse pointer is over the dashboard item and a mouse button is released.

Namespace : DevExpress.DashboardWpf

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

NuGet Package : DevExpress.Wpf.Dashboard

Declaration

csharp
public event DashboardItemMouseActionWpfEventHandler DashboardItemMouseUp
vb
Public Event DashboardItemMouseUp As DashboardItemMouseActionWpfEventHandler

Event Data

The DashboardItemMouseUp event's data class is DashboardItemMouseActionWpfEventArgs. The following properties provide information specific to this event:

PropertyDescription
DashboardItemNameGets the name of the dashboard item. Inherited from DashboardItemMouseWpfEventArgs.
DataGets the data displayed in the dashboard item.

The event data class exposes the following methods:

MethodDescription
GetAxisPoint()Obtains the AxisPoint object located at the top priority axis and related to the visual element under the test point.
GetAxisPoint(String)Obtains the AxisPoint object located at the specified axis and related to the visual element under the test point.
GetDeltas()Gets a list of delta descriptors related to the visual element located under the test point.
GetMeasures()Gets a list of measure descriptors related to the visual element located under the test point.
GetSlice()Returns the data slice for the Default axis by the AxisPoint related to the visual element located under the test point.
GetSlice(String)Returns the data slice for the specified axis by the AxisPoint related to the visual element located under the test point.
GetUnderlyingData()Returns underlying data related to the visual element located under the test point.
GetUnderlyingData(IList<String>)Returns underlying data related to the visual element located under the test point.
GetUnderlyingData(String, IList<String>)Returns underlying data related to the visual element located under the test point.
GetUnderlyingData(String)Returns underlying data related to the visual element located under the test point.

Remarks

Use the e.DashboardItemName property to obtain the dashboard item name for which the event is raised.

To obtain the data related to the dashboard item element, use the following methods:

The event retrieves data from different dashboard item’s visual elements:

The event has the following limitations:

View Example: How to handle a mouse click to obtain dashboard item data

csharp
private void DashboardControl_DashboardItemMouseUp(object sender, DevExpress.DashboardWpf.DashboardItemMouseActionWpfEventArgs e)
{
    if (e.DashboardItemName == "cardDashboardItem1" & e.GetAxisPoint() != null)
    {
        // Obtains client data related to the clicked card.
        MultiDimensionalData clickedItemData = e.GetSlice();
        DeltaDescriptor delta = e.GetDeltas()[0];

        // Creates a data table that will be used to hold client data.
        DataTable dataSource = new DataTable();
        dataSource.Columns.Add("Argument", typeof(DateTime));
        dataSource.Columns.Add("Actual", typeof(double));
        dataSource.Columns.Add("Target", typeof(double));

        // Saves values of axis points placed on the "sparkline" axis and corresponding
        // actual/target values to the data table.
        foreach (AxisPoint point in
            clickedItemData.GetAxisPoints(DashboardDataAxisNames.SparklineAxis))
        {
            DataRow row = dataSource.NewRow();
            DeltaValue deltaValue = clickedItemData.GetSlice(point).GetDeltaValue(delta);
            if (deltaValue.ActualValue.Value != null &&
                deltaValue.TargetValue.Value != null)
            {
                row["Argument"] = point.Value;
                row["Actual"] = deltaValue.ActualValue.Value;
                row["Target"] = deltaValue.TargetValue.Value;
            }
            else
            {
                row["Argument"] = DBNull.Value;
                row["Actual"] = DBNull.Value;
                row["Target"] = DBNull.Value;
            }
            dataSource.Rows.Add(row);
        }
        DisplayDetailedChart(GetFormTitle(clickedItemData), dataSource);
    }
}
vb
Private Sub DashboardControl_DashboardItemMouseUp(ByVal sender As Object, ByVal e As DevExpress.DashboardWpf.DashboardItemMouseActionWpfEventArgs)
    If e.DashboardItemName = "cardDashboardItem1" And e.GetAxisPoint() IsNot Nothing Then
        ' Obtains client data related to the clicked card.
        Dim clickedItemData As MultiDimensionalData = e.GetSlice()
        Dim delta As DeltaDescriptor = e.GetDeltas()(0)

        ' Creates a data table that will be used to hold client data.
        Dim dataSource As New DataTable()
        dataSource.Columns.Add("Argument", GetType(Date))
        dataSource.Columns.Add("Actual", GetType(Double))
        dataSource.Columns.Add("Target", GetType(Double))

        ' Saves values of axis points placed on the "sparkline" axis and corresponding
        ' actual/target values to the data table.
        For Each point As AxisPoint In clickedItemData.GetAxisPoints(DashboardDataAxisNames.SparklineAxis)
            Dim row As DataRow = dataSource.NewRow()
            Dim deltaValue As DeltaValue = clickedItemData.GetSlice(point).GetDeltaValue(delta)
            If deltaValue.ActualValue.Value IsNot Nothing AndAlso deltaValue.TargetValue.Value IsNot Nothing Then
                row("Argument") = point.Value
                row("Actual") = deltaValue.ActualValue.Value
                row("Target") = deltaValue.TargetValue.Value
            Else
                row("Argument") = DBNull.Value
                row("Actual") = DBNull.Value
                row("Target") = DBNull.Value
            End If
            dataSource.Rows.Add(row)
        Next point
        DisplayDetailedChart(GetFormTitle(clickedItemData), dataSource)
    End If
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DashboardItemMouseUp event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-dashboard-how-to-obtain-clicked-item-data/CS/Dashboard_ClientDataCards_Wpf/MainWindow.xaml#L12

xml
<dxdash:DashboardControl DashboardSource="{x:Type local:Dashboard1}" DashboardItemMouseUp="DashboardControl_DashboardItemMouseUp"/>

wpf-dashboard-how-to-obtain-clicked-item-data/CS/Dashboard_ClientDataCards_Wpf/obj/Debug/net8.0-windows/MainWindow.g.cs#L79

csharp
#line 12 "..\..\..\MainWindow.xaml"
((DevExpress.DashboardWpf.DashboardControl)(target)).DashboardItemMouseUp += new DevExpress.DashboardWpf.DashboardItemMouseActionWpfEventHandler(this.DashboardControl_DashboardItemMouseUp);

wpf-dashboard-how-to-obtain-clicked-item-data/VB/Dashboard_ClientDataCards_Wpf/obj.NetFX/Debug/MainWindow.g.vb#L79

vb
#ExternalSource("..\..\MainWindow.xaml",12)
AddHandler CType(target,DevExpress.DashboardWpf.DashboardControl).DashboardItemMouseUp, New DevExpress.DashboardWpf.DashboardItemMouseActionWpfEventHandler(AddressOf Me.DashboardControl_DashboardItemMouseUp)

See Also

DashboardControl Class

DashboardControl Members

DevExpress.DashboardWpf Namespace