Share via


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

要获取其前面的读取顺序元素的元素。

返回

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

示例

<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 方法以添加新元素。

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

适用于