[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Get Started With Data Grid and Views
   [Expand]Data Binding
    Unbound Columns
   [Expand]Data Editing and Validation
   [Expand]Filter and Search
   [Expand]Focus and Selection Handling
    Format Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
   [Expand]Batch Modifications
    Hit Information
    Popup Menus
   [Expand]Save and Restore Layout
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Hit Information

Expanded Online Video

  • Hit Information

    This tutorial shows how to use hit information to perform the following tasks:

    • display tooltips that indicate which element is under the mouse cursor;
    • apply/clear filters on a cell click.

    Watch the Video | Read the Walkthrough


To identify a View's visual element at specific coordinates, call the View's CalcHitInfo method.

These methods accept a point measured in grid control client coordinates and return HitInfo objects with information that identifies the test point. Different View types return different HitInfo objects. For example, a GridView returns a GridHitInfo object, a LayoutView returns a LayoutViewHitInfo object, etc.

Test if a point belongs to a particular visual element

To identify whether a point belongs to a certain visual element (for example, column header filter button, row preview region, row/column edge, row cell), read the HitInfo.HitTest enumeration property (for instance, GridHitTest enumerates all visual elements in the GridView class).

The HitInfo objects also provide helper properties to identify complex visual elements (for example, a row, data row, column header panel, etc.). These properties have the "In..." prefix. For example:

  • HitInfo.InRow returns whether the test point belongs to the 'row' visual element. This complex element includes row cells, row preview region, indicator button, edges, group button (for group rows), etc.
  • HitInfo.InColumn returns true if the test point belongs to the column header button or the column header filter button.

Identify the row/column/band/card

To identify the column, row, and band (when applicable) that contain the test point, use the corresponding properties the HitInfo objects provide: HitInfo.Column, HitInfo.RowHandle and HitInfo.Band.

To determine which View is at the specified coordinates when the GridControl displays multiple Views, call the GridControl.GetViewAt method.

Expanded Example

The following sample code shows how to identify the element located at a specific point using the GridView.CalcHitInfo method.

In the example, the CalcHitInfo method is called when you move the cursor over a Grid Control. The name of the current View element is displayed in the form's caption.

Expanded Example

This example shows how to display a context menu when an end-user right-clicks the Header Panel Button. The created context menu contains a "Column Auto Width" check box. This menu item toggles the GridOptionsView.ColumnAutoWidth option.

Expanded See Also

Is this topic helpful?​​​​​​​