Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

SelectionPattern.Pattern Field

Definition

Namespace:
System.Windows.Automation
Assembly:
UIAutomationClient.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Identifies the SelectionPattern control pattern.

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

Field Value

Examples

In the following example, a SelectionPattern control pattern is obtained from an AutomationElement.

///--------------------------------------------------------------------
/// <summary>
/// Obtains a SelectionPattern control pattern from an 
/// automation element.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// A SelectionPattern object.
/// </returns>
///--------------------------------------------------------------------
private SelectionPattern GetSelectionPattern(
 AutomationElement targetControl)
{
 SelectionPattern selectionPattern = null;

 try
 {
 selectionPattern =
 targetControl.GetCurrentPattern(SelectionPattern.Pattern)
 as SelectionPattern;
 }
 // Object doesn't support the SelectionPattern control pattern
 catch (InvalidOperationException)
 {
 return null;
 }

 return selectionPattern;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains a SelectionPattern control pattern from an 
''' automation element.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
''' <returns>
''' A SelectionPattern object.
''' </returns>
'''--------------------------------------------------------------------
Private Function GetSelectionPattern( _
ByVal targetControl As AutomationElement) As SelectionPattern
 Dim selectionPattern As SelectionPattern = Nothing

 Try
 selectionPattern = DirectCast( _
 targetControl.GetCurrentPattern(selectionPattern.Pattern), _
 SelectionPattern)
 ' Object doesn't support the SelectionPattern control pattern
 Catch
 Return Nothing
 End Try

 Return selectionPattern
End Function 'GetSelectionPattern

Remarks

This identifier is used by UI Automation client applications. UI Automation providers should use the equivalent field in SelectionPatternIdentifiers.

The pattern identifier is passed to methods such as GetCurrentPattern to retrieve the control pattern of interest from the specified AutomationElement.

Applies to


Feedback

Was this page helpful?