AutomationProperties.GetFlowsFrom(DependencyObject) AutomationProperties.GetFlowsFrom(DependencyObject) AutomationProperties.GetFlowsFrom(DependencyObject) AutomationProperties.GetFlowsFrom(DependencyObject) Method

Definition

Gets a list of automation elements that suggests the reading order before the specified automation element.

public : static IVector<DependencyObject> GetFlowsFrom(DependencyObject element)
static IVector<DependencyObject> GetFlowsFrom(DependencyObject element) const;
public static IList<DependencyObject> GetFlowsFrom(DependencyObject element)
Public Shared Function GetFlowsFrom(element As DependencyObject) As IList<DependencyObject>(Of DependencyObject)
Parameters
element
DependencyObject DependencyObject

The element for which to get the preceding reading order elements.

Returns
IList<DependencyObject> IList<DependencyObject>

A list of automation elements that suggests the reading order before the automation element specified by the element parameter.

Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Examples

<StackPanel>
    <Button x:Name="first">First</Button>
    <Button x:Name="third">Third</Button>
    <Button x:Name="second">Second</Button>
    <Button x:Name="fourth">Fourth</Button>
</StackPanel>
public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();

        // Override the default flow for next/previous items in 
        // UI Automation to differ from the sequence of items 
        // declared in markup
        FlowBetween(first, second);
        FlowBetween(second, third);
        FlowBetween(third, fourth);
    }

    public void FlowBetween(UIElement fromElement, UIElement toElement)
    {
        // Set up the flow as bi-directional so that moving next/previous is
        // consistent.
        var flowsToList = AutomationProperties.GetFlowsTo(fromElement);
        var flowsFromList = AutomationProperties.GetFlowsFrom(toElement);

        flowsToList.Add(toElement);
        flowsFromList.Add(fromElement);
    }
}

Remarks

Get the list, then call the Add method to add a new element.

Important

When modifying the flow, be careful not to create a situation where the user gets stuck in a navigation loop that they can't escape if they are only using a keyboard.