共用方式為


WindowPattern.WindowInteractionStateProperty 欄位

定義

識別 WindowInteractionState 屬性。

public: static initonly System::Windows::Automation::AutomationProperty ^ WindowInteractionStateProperty;
public static readonly System.Windows.Automation.AutomationProperty WindowInteractionStateProperty;
 staticval mutable WindowInteractionStateProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly WindowInteractionStateProperty As AutomationProperty 

欄位值

範例

在下列範例中,根項目會傳遞至函式,此函式會傳回屬於根子系的自動化專案集合,並滿足一組屬性條件。

///--------------------------------------------------------------------
/// <summary>
/// Finds all automation elements that satisfy 
/// the specified condition(s).
/// </summary>
/// <param name="rootElement">
/// The automation element from which to start searching.
/// </param>
/// <returns>
/// A collection of automation elements satisfying 
/// the specified condition(s).
/// </returns>
///--------------------------------------------------------------------
private AutomationElementCollection FindAutomationElement(
    AutomationElement rootElement)
{
    if (rootElement == null)
    {
        throw new ArgumentException("Root element cannot be null.");
    }

    PropertyCondition conditionCanMaximize = 
        new PropertyCondition(WindowPattern.CanMaximizeProperty, true);

    PropertyCondition conditionCanMinimize =
        new PropertyCondition(WindowPattern.CanMinimizeProperty, true);

    PropertyCondition conditionIsModal =
        new PropertyCondition(WindowPattern.IsModalProperty, false);

    PropertyCondition conditionIsTopmost =
        new PropertyCondition(WindowPattern.IsTopmostProperty, true);

    PropertyCondition conditionWindowInteractionState =
        new PropertyCondition(
        WindowPattern.WindowInteractionStateProperty, 
        WindowInteractionState.ReadyForUserInteraction);

    PropertyCondition conditionWindowVisualState =
        new PropertyCondition(
        WindowPattern.WindowVisualStateProperty, 
        WindowVisualState.Normal);

    // Use any combination of the preceding condtions to 
    // find the control(s) of interest
    Condition condition = new AndCondition(
        conditionCanMaximize, 
        conditionIsModal, 
        conditionWindowInteractionState);

    return rootElement.FindAll(TreeScope.Descendants, condition); 
}
'''------------------------------------------------------------------------
''' <summary>
''' Finds all automation elements that satisfy 
''' the specified condition(s).
''' </summary>
''' <param name="rootElement">
''' The automation element from which to start searching.
''' </param>
''' <returns>
''' A collection of automation elements satisfying 
''' the specified condition(s).
''' </returns>
'''------------------------------------------------------------------------
Private Function FindAutomationElement( _
    ByVal rootElement As AutomationElement) As AutomationElementCollection
    If rootElement Is Nothing Then
        Throw New ArgumentException("Root element cannot be null.")
    End If

    Dim conditionCanMaximize As _
        New PropertyCondition(WindowPattern.CanMaximizeProperty, True)

    Dim conditionCanMinimize As _
        New PropertyCondition(WindowPattern.CanMinimizeProperty, True)

    Dim conditionIsModal As _
        New PropertyCondition(WindowPattern.IsModalProperty, False)

    Dim conditionIsTopmost As _
        New PropertyCondition(WindowPattern.IsTopmostProperty, True)

    Dim conditionWindowInteractionState As _
        New PropertyCondition(WindowPattern.WindowInteractionStateProperty, _
        WindowInteractionState.ReadyForUserInteraction)

    Dim conditionWindowVisualState As _
        New PropertyCondition(WindowPattern.WindowVisualStateProperty, _
        WindowVisualState.Normal)

    ' Use any combination of the preceding condtions to 
    ' find the control(s) of interest
    Dim condition = New AndCondition(conditionCanMaximize, _
        conditionIsModal, conditionWindowInteractionState)

    Return rootElement.FindAll(TreeScope.Descendants, condition)

End Function 'FindAutomationElement

備註

消費者介面自動化用戶端應用程式會使用此識別碼。 消費者介面自動化提供者應該使用 中的 WindowPatternIdentifiers 對等欄位。

適用於