MultipleViewPattern.MultipleViewPatternInformation.GetSupportedViews MultipleViewPattern.MultipleViewPatternInformation.GetSupportedViews MultipleViewPattern.MultipleViewPatternInformation.GetSupportedViews MultipleViewPattern.MultipleViewPatternInformation.GetSupportedViews Method

Definition

Ruft eine Auflistung steuerelementspezifischer Ansichtsbezeichner ab.Retrieves a collection of control-specific view identifiers.

public:
 cli::array <int> ^ GetSupportedViews();
public int[] GetSupportedViews ();
member this.GetSupportedViews : unit -> int[]
Public Function GetSupportedViews () As Integer()

Gibt zurück

Int32[]

Eine Auflistung von Ganzzahlwerten, die die für ein AutomationElement verfügbaren Ansichten angeben.A collection of integer values that identify the views available for an AutomationElement. Der Standardwert ist ein leeres Ganzzahlarray.The default is an empty integer array.

Beispiele

Im folgenden Beispiel wird eine Auflistung von ganzzahligen bezeichgern abgerufen, die die für ein Steuerelement verfügbaren Sichten MultipleViewPatterndarstellt, die unterstützt.In the following example, a collection of integer identifiers is obtained, representing the views available for a control that supports MultipleViewPattern.

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

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

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

    Try
        multipleViewPattern = DirectCast( _
        targetControl.GetCurrentPattern(multipleViewPattern.Pattern), _
        MultipleViewPattern)
    Catch exc As InvalidOperationException
        'Object doesn't support the MultipleViewPattern control pattern
        Return Nothing
    End Try

    Return multipleViewPattern
End Function 'GetMultipleViewPattern    
///--------------------------------------------------------------------
/// <summary>
/// Gets the collection of currently supported views from a target.
/// </summary>
/// <param name="multipleViewPattern">
/// The MultipleViewPattern obtained from a multiple view control.
/// </param>
/// <returns>
/// A collection of identifiers representing the supported views.
/// </returns>
///--------------------------------------------------------------------
private int[] GetSupportedViewsFromControl(
    MultipleViewPattern multipleViewPattern)
{
    if (multipleViewPattern == null)
    {
        throw new ArgumentNullException(
            "MultipleViewPattern parameter must not be null.");
    }

    return multipleViewPattern.Current.GetSupportedViews();
}
'/--------------------------------------------------------------------
'/ <summary>
'/ Gets the collection of currently supported views from a target.
'/ </summary>
'/ <param name="multipleViewPattern">
'/ The MultipleViewPattern obtained from a multiple view control.
'/ </param>
'/ <returns>
'/ A collection of identifiers representing the supported views.
'/ </returns>
'/--------------------------------------------------------------------
Private Function GetSupportedViewsFromControl( _
ByVal multipleViewPattern As MultipleViewPattern) As Integer()
    If multipleViewPattern Is Nothing Then
        Throw New ArgumentNullException( _
        "MultipleViewPattern parameter must not be null.")
    End If

    Return multipleViewPattern.Current.GetSupportedViews()

End Function 'GetSupportedViewsFromControl    

Hinweise

Die Auflistung von Ansichts Bezeichner ist zwischen Instanzen identisch.The collection of view identifiers is identical across instances.

Ansichts-ID-Werte können GetViewNamean die-Werte anView identifier values can be passed to GetViewName.

Gilt für: