GeometryHitTestParameters(Geometry) Constructor

Definition

Initializes a new instance of the GeometryHitTestParameters class, using the specified Geometry.

C#
public GeometryHitTestParameters(System.Windows.Media.Geometry geometry);

Parameters

geometry
Geometry

The Geometry value to use for the hit test geometry.

Examples

The following example shows how to set up a hit test by using GeometryHitTestParameters for the HitTest method. A Point value is used to create a Geometry object to expand the range of the hit test over a wider display area.

C#
// Retrieve the coordinate of the mouse position.
Point pt = e.GetPosition((UIElement)sender);

// Expand the hit test area by creating a geometry centered on the hit test point.
EllipseGeometry expandedHitTestArea = new EllipseGeometry(pt, 10.0, 10.0);

// Set up a callback to receive the hit test result enumeration.
VisualTreeHelper.HitTest(myControl, null,
    new HitTestResultCallback(MyHitTestResultCallback),
    new GeometryHitTestParameters(expandedHitTestArea));

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also