VisualTreeHelper.HitTest Method (Visual3D, HitTestFilterCallback, HitTestResultCallback, HitTestParameters3D)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Initiates a hit test on the specified Visual3D, with caller-defined HitTestFilterCallback and HitTestResultCallback methods.

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

public static void HitTest(
	Visual3D reference,
	HitTestFilterCallback filterCallback,
	HitTestResultCallback resultCallback,
	HitTestParameters3D hitTestParameters


Type: System.Windows.Media.Media3D.Visual3D

The Visual3D to hit test.

Type: System.Windows.Media.HitTestFilterCallback

The method that represents the hit test filter callback value.

Type: System.Windows.Media.HitTestResultCallback

The method that represents the hit test result callback value.

Type: System.Windows.Media.Media3D.HitTestParameters3D

The 3D parameter value to hit test against.

The filterCallback parameter can be null, in which case, it is ignored. If filterCallback is not null, it is invoked before resultCallback. resultCallback cannot be null.


It is possible for a hit test that starts in a 2D visual tree to return RayHitTestResult, which is a 3D hit test result object. Hit testing that starts in a 2D visual tree seamlessly extends into any defined 3D visual tree.

.NET Framework
Available since 3.0
Return to top