Skip to main content
A newer version of this page is available. .

How to: Obtain the Dashboard Item Underlying Data When the Mouse Hovers Over It

  • 2 minutes to read

This example handles the DashboardItemMouseEnter, DashboardItemMouseMove and DashboardItemMouseLeave events to display a popup that contains a GridControl to display item data when the mouse hovers over it. The data are obtained using the e.GetUnderlyingData method.

Note

The complete sample project How to obtain dashboard item’s underlying data when the mouse hovers over it is available in the DevExpress Examples repository.

using DevExpress.DashboardCommon;
using DevExpress.DashboardWpf;
using System.Windows;

namespace Dashboard_UnderlyingDataWPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void DashboardControl_DashboardItemMouseMove(object sender, DashboardItemMouseActionWpfEventArgs e)
        {
            if (e.DashboardItemName != null)
            {
                DashboardUnderlyingDataSet underlyingData = e.GetUnderlyingData();
                myGrid.ItemsSource = underlyingData;
                tooltip.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
            }
        }

        private void DashboardControl_DashboardItemMouseEnter(object sender, DashboardItemMouseWpfEventArgs e)
        {
            tooltip.IsOpen = true;
        }

        private void DashboardControl_DashboardItemMouseLeave(object sender, DashboardItemMouseWpfEventArgs e)
        {
            tooltip.IsOpen = false;
        }
    }
}