AutomationElementCollection.Item[Int32] Właściwość

Definicja

Pobiera obiekt AutomationElement w określonym indeksie.

public:
 property System::Windows::Automation::AutomationElement ^ default[int] { System::Windows::Automation::AutomationElement ^ get(int index); };
public System.Windows.Automation.AutomationElement this[int index] { get; }
member this.Item(int) : System.Windows.Automation.AutomationElement
Default Public ReadOnly Property Item(index As Integer) As AutomationElement

Parametry

index
Int32

Indeks zerowy elementu w kolekcji.

Wartość właściwości

AutomationElement

Element AutomationElement w określonym indeksie.

Wyjątki

Liczba całkowita ujemna została określona dla index, lub index jest większa lub równa Count.

Przykłady

W poniższym przykładzie pierwszy element jest pobierany z obiektu AutomationElementCollection.

// desktopChildren is a collection of AutomationElement objects.
AutomationElement firstWindow;
try
{
    firstWindow = desktopChildren[0];
}
catch (IndexOutOfRangeException)
{
    Console.WriteLine("No AutomationElement at that index.");
}
' desktopChildren is a collection of AutomationElement objects.
Dim firstWindow As AutomationElement
Try
    firstWindow = desktopChildren(0)
Catch ex As IndexOutOfRangeException
    Console.WriteLine("No AutomationElement at that index.")
End Try

Dotyczy