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

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

  • 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.

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;
        }
    }
}