AutomationProperties.GetFlowsFrom(DependencyObject) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 const& element);
public static IList<DependencyObject> GetFlowsFrom(DependencyObject element);
function getFlowsFrom(element)
Public Shared Function GetFlowsFrom (element As DependencyObject) As IList(Of DependencyObject)
Parameters
- element
- DependencyObject
The element for which to get the preceding reading order elements.
Returns
A list of automation elements that suggests the reading order before the automation element specified by the element parameter.
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.