Class HitTestResult<TElement>
Result of a hit test operation against a specific element type.
public class HitTestResult<TElement>
Type Parameters
TElementThe type of element that can be hit.
- Inheritance
-
HitTestResult<TElement>
- Inherited Members
Properties
CanvasPosition
The position where the hit occurred, in canvas coordinates.
[CoordinateSpace(CoordinateSpace.Canvas)]
public Point CanvasPosition { get; init; }
Property Value
Distance
Distance from the exact hit point to the element's bounds or center. Useful for edge hit testing where some tolerance is needed.
public double Distance { get; init; }
Property Value
Element
The element that was hit, or null/default if nothing was hit.
public TElement? Element { get; init; }
Property Value
- TElement
IsHit
Whether an element was hit.
public bool IsHit { get; }
Property Value
LocalPosition
The position where the hit occurred, relative to the element's origin. Only meaningful when Element is not null.
[CoordinateSpace(CoordinateSpace.Local)]
public Point LocalPosition { get; init; }
Property Value
Methods
NoHit(Point)
Creates an empty (no hit) result.
public static HitTestResult<TElement> NoHit(Point canvasPosition)
Parameters
canvasPositionPoint
Returns
- HitTestResult<TElement>