ValueIndicatorBase.IsHitTestVisible Property
Gets or sets a value that defines whether an indicator can be returned as a hit-testing result.
Namespace: DevExpress.Xpf.Gauges
Assembly: DevExpress.Xpf.Gauges.v20.2.dll
NuGet Packages: DevExpress.WindowsDesktop.Wpf.Gauges, DevExpress.Wpf.Gauges
Declaration
Property Value
Type | Description |
---|---|
Boolean | true in case the indicator can be shown as the result of hit testing; otherwise false. |
Remarks
If the IsHitTestVisible property is set to false, the indicator ignores any input events and hit testing. So, by default, this property is set to true.
Example
This example demonstrates how to show a tooltip with the current value of a needle on a circular gauge.
To do this, it is necessary to handle the MouseMove and MouseLeave events for the CircularGaugeControl object and obtain the current mouse position on a scale via the CircularGaugeControl.CalcHitInfo method. After that, if the mouse pointer hovers over the needle, it becomes possible to invoke the tooltip that displays the current needle’s value.
Note that this approach is applicable to only those gauge elements whose ValueIndicatorBase.IsHitTestVisible
property is set to True (this is the default option). If the IsHitTestVisible property is set to False, this element is excluded from the hit-testing algorithm. To explore this behavior in action, mark and unmark the “Show tooltips for a needle” CheckEdit (whose check state is bound to the needle’s IsHitTestVisible property). So, the unmarked CheckEdit’s state means that tooltips are not displayed for a needle.
Imports Microsoft.VisualBasic
Imports System.Windows
Imports System.Windows.Controls.Primitives
Imports System.Windows.Input
Imports DevExpress.Xpf.Gauges
Namespace DXGauges_ShowTooltips
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub circularGaugeControl1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim hitInfo As CircularGaugeHitInfo = circularGaugeControl1.CalcHitInfo(e.GetPosition(circularGaugeControl1))
If hitInfo.InNeedle Then
tooltip_text.Text = "Value: " & hitInfo.Needle.Value.ToString("n2")
tooltip.Placement = PlacementMode.Mouse
tooltip.IsOpen = True
Else
tooltip.IsOpen = False
End If
End Sub
Private Sub circularGaugeControl1_MouseLeave(ByVal sender As Object, ByVal e As MouseEventArgs)
tooltip.IsOpen = False
End Sub
End Class
End Namespace
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the IsHitTestVisible 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.