Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 1.41 KB

how-to-hit-test-in-a-viewport3d.md

File metadata and controls

26 lines (21 loc) · 1.41 KB
title description ms.date dev_langs helpviewer_keywords ms.assetid
How to: Hit Test in a Viewport3D
Learn how to perform a hit test for 3D Visuals in the bounds of a Viewport3D element containing 2D and 3D information.
03/30/2017
csharp
vb
3D visuals [WPF], hit-testing for
hit tests [WPF], for 3D visuals
Viewport3D [WPF]
42bfbd99-c7c6-43f1-940b-90448faa412e

How to: Hit Test in a Viewport3D

This example shows how to hit test for 3D Visuals in a xref:System.Windows.Controls.Viewport3D.

Because xref:System.Windows.Media.VisualTreeHelper.HitTest%2A returns 2D and 3D information, it is possible to iterate through the test results to read only 3D results.

[!code-csharpHitTest3D#HitTest3D3DN4] [!code-vbHitTest3D#HitTest3D3DN4]

The xref:System.Windows.Media.HitTestResultBehavior in the following code determines how the hit test results are processed. UpdateResultInfo and UpdateMaterial are locally defined methods.

[!code-csharpHitTest3D#HitTest3D3DN5] [!code-vbHitTest3D#HitTest3D3DN5]