The requested page is not available for the requested platform. You are viewing the content for Default platform.

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

  • 2 min 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;
        }
    }
}