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 方法以新增專案。

重要

修改流程時,請小心不要建立使用者卡在流覽迴圈中的情況,如果他們只使用鍵盤,他們就無法逸出。

適用於