Visual.HitTestCore Method (GeometryHitTestParameters)

Determines whether a geometry value is within the bounds of the visual object.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)

protected virtual GeometryHitTestResult HitTestCore (
	GeometryHitTestParameters hitTestParameters
protected GeometryHitTestResult HitTestCore (
	GeometryHitTestParameters hitTestParameters
protected function HitTestCore (
	hitTestParameters : GeometryHitTestParameters
) : GeometryHitTestResult
You cannot use methods in XAML.



A value of type GeometryHitTestParameters that specifies the Geometry to hit test against.

Return Value

Returns a value of type GeometryHitTestResult.

You can override a visual object’s default hit testing support by overriding the HitTestCore method. This means that when you invoke the HitTest method, your overridden implementation of HitTestCore is called. Your overridden method is called when a hit test falls within the bounding rectangle of the visual object, even if the coordinate falls outside the geometry of the visual object.

The following example shows how to override the HitTestCore method. One reason why you might want to override this method is to provide additional functionality, during the hit testing process, that might change the default hit testing.

// Override default hit test support in visual object.
protected override GeometryHitTestResult HitTestCore(GeometryHitTestParameters hitTestParameters)
    IntersectionDetail intersectionDetail = IntersectionDetail.NotCalculated;

    // Perform custom actions during the hit test processing.

    return new GeometryHitTestResult(this, intersectionDetail);

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0