Back to Devexpress

HotTrackEventArgs.Object Property

corelibraries-devexpress-dot-xtracharts-dot-hottrackeventargs-5b9e9b63.md

latest6.1 KB
Original Source

HotTrackEventArgs.Object Property

Gets the chart element, for which the event was raised.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public object Object { get; }
vb
Public ReadOnly Property [Object] As Object

Property Value

TypeDescription
Object

A Object which represents the chart element for which the event was raised.

|

Example

This example demonstrates how to implement custom hot-tracking and selection of the chart’s elements at runtime.

Note

To enable runtime hot-tracking and selection, the ChartControl.SelectionMode property should be set to Single, Multiple or Extended.

If you want to change the default hot-tracking and selection, you should handle the ChartControl.ObjectHotTracked and ChartControl.ObjectSelected events, implement your custom hot-tracking and selection approaches and set the Cancel property to true.

For example, the code below illustrates how to disable selection and hot-tracking of a chart’s diagram.

csharp
using DevExpress.XtraCharts;
// ...

private void chartControl1_ObjectHotTracked(object sender, HotTrackEventArgs e) {
   // Prevent the chart's diagram from being hot-tracked.
   if (e.Object is Diagram) 
      e.Cancel = true;
}

private void chartControl1_ObjectSelected(object sender, HotTrackEventArgs e) {
   // Prevent the chart's Diagram from being selected.
   if (e.Object is Diagram) 
      e.Cancel = true;
}
vb
Imports DevExpress.XtraCharts
' ...

Private Sub OnObjectHotTracked(sender As Object, e As HotTrackEventArgs) _
Handles ChartControl1.ObjectHotTracked
   ' Prevent the chart's Diagram from being hot-tracked.
   If TypeOf e.Object Is Diagram Then
      e.Cancel = True
   End If
End Sub

Private Sub OnObjectSelected(sender As Object, e As HotTrackEventArgs) _
Handles ChartControl1.ObjectSelected
   ' Prevent the chart's Diagram from being selected.
   If TypeOf e.Object Is Diagram Then
      e.Cancel = True
   End If
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the Object property.

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.

winforms-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/Funnel/FunnelItemControlProvider.cs#L91

csharp
void Chart_ObjectHotTracked(object sender, HotTrackEventArgs e) {
    e.Cancel = !(e.Object is Series);
}

winforms-charts-show-chart-legend-with-markers-in-separate-control/CS/Form1.cs#L77

csharp
{
    gridView1.FocusedRowHandle = gridView1.GetRowHandle(chart.Series.IndexOf(((Series)e.Object)));
}

winforms-dashboard-custom-items/CS/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.cs#L94

csharp
void Chart_ObjectHotTracked(object sender, HotTrackEventArgs e) {
    e.Cancel = !(e.Object is Series);
}

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/Funnel/FunnelItemControlProvider.vb#L104

vb
Private Sub Chart_ObjectHotTracked(ByVal sender As Object, ByVal e As HotTrackEventArgs)
    e.Cancel = Not (TypeOf e.Object Is Series)
End Sub

winforms-charts-show-chart-legend-with-markers-in-separate-control/VB/Form1.vb#L72

vb
If e.HitInfo.InSeries Then
    gridView1.FocusedRowHandle = gridView1.GetRowHandle(chart.Series.IndexOf(CType(e.Object, Series)))
End If

winforms-dashboard-custom-items/VB/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.vb#L96

vb
Private Sub Chart_ObjectHotTracked(ByVal sender As Object, ByVal e As HotTrackEventArgs)
    e.Cancel = Not (TypeOf e.Object Is Series)
End Sub

See Also

HotTrackEventArgs Class

HotTrackEventArgs Members

DevExpress.XtraCharts Namespace