WindowPattern.IsTopmostProperty 字段
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
标识 IsTopmost 属性。
public: static initonly System::Windows::Automation::AutomationProperty ^ IsTopmostProperty;
public static readonly System.Windows.Automation.AutomationProperty IsTopmostProperty;
staticval mutable IsTopmostProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly IsTopmostProperty 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
注解
此标识符由UI 自动化客户端应用程序使用。 UI 自动化提供程序应使用等效字段。WindowPatternIdentifiers