AutomationProperties.GetFlowsFrom(DependencyObject) 方法

定义

获取自动化元素的列表,该列表建议指定自动化元素之前的阅读顺序。

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)

参数

element
DependencyObject

要获取其上一个读取顺序元素的元素。

返回

自动化元素的列表,建议在 元素参数指定的 自动化元素之前阅读顺序。

Windows 要求

设备系列
Windows 10 Anniversary Edition (在 10.0.14393.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v3.0 中引入)

示例

<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);
    }
}

注解

获取列表,然后调用 Add 方法来添加新元素。

重要

修改流时,请注意,不要造成用户卡在导航循环中的情况,如果用户仅使用键盘,则无法转义。

适用于