AutomationProperties.GetFlowsTo(DependencyObject) 方法

定义

获取自动化元素的列表,这些元素建议指定自动化元素之后的读取顺序。

public:
 static IVector<DependencyObject ^> ^ GetFlowsTo(DependencyObject ^ element);
 static IVector<DependencyObject> GetFlowsTo(DependencyObject const& element);
public static IList<DependencyObject> GetFlowsTo(DependencyObject element);
function getFlowsTo(element)
Public Shared Function GetFlowsTo (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 方法以添加新元素。

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

适用于