XYFocusNavigationStrategy Enum
Definition
Specifies the disambiguation strategy used for navigating between multiple candidate targets using Avalonia.Input.XYFocus.DownNavigationStrategyProperty, Avalonia.Input.XYFocus.LeftNavigationStrategyProperty, Avalonia.Input.XYFocus.RightNavigationStrategyProperty, and Avalonia.Input.XYFocus.UpNavigationStrategyProperty.
public enum XYFocusNavigationStrategy
Fields
| Name | Description |
|---|---|
| Auto | Indicates that navigation strategy is inherited from the element's ancestors. If all ancestors have a value of Auto, the fallback strategy is Projection. |
| NavigationDirectionDistance | Indicates that focus moves to the element closest to the axis of the navigation direction. |
| Projection | Indicates that focus moves to the first element encountered when projecting the edge of the currently focused element in the direction of navigation. |
| RectilinearDistance | Indicates that focus moves to the closest element based on the shortest 2D distance (Manhattan metric). |
Auto Field
Indicates that navigation strategy is inherited from the element's ancestors. If all ancestors have a value of Auto, the fallback strategy is Projection.
public Avalonia.Input.XYFocusNavigationStrategy Auto
NavigationDirectionDistance Field
Indicates that focus moves to the element closest to the axis of the navigation direction.
public Avalonia.Input.XYFocusNavigationStrategy NavigationDirectionDistance
Remarks
The edge of the bounding rect corresponding to the navigation direction is extended and projected to identify candidate targets. The first element encountered is identified as the target. In the case of multiple candidates, the closest element is identified as the target. If there are still multiple candidates, the topmost/leftmost element is identified as the candidate.
Projection Field
Indicates that focus moves to the first element encountered when projecting the edge of the currently focused element in the direction of navigation.
public Avalonia.Input.XYFocusNavigationStrategy Projection
RectilinearDistance Field
Indicates that focus moves to the closest element based on the shortest 2D distance (Manhattan metric).
public Avalonia.Input.XYFocusNavigationStrategy RectilinearDistance
Remarks
This distance is calculated by adding the primary distance and the secondary distance of each potential candidate. In the case of a tie:
- The first element to the left is selected if the navigation direction is up or down
- The first element to the top is selected if the navigation direction is left or right Here we show how focus moves from A to B based on rectilinear distance.
- Distance (A, B, Down) = 10 + 0 = 10
- Distance (A, C, Down) = 0 + 30 = 30
- Distance (A, D, Down) 30 + 0 = 30