Freigeben über


AutomationElementCollection.Item[Int32] Eigenschaft

Definition

Ruft den AutomationElement am angegebenen Index ab.

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

Parameter

index
Int32

Der nullbasierte Index des Elements in der Auflistung.

Eigenschaftswert

AutomationElement

Das AutomationElement-Objekt am angegebenen Index.

Ausnahmen

Für index wurde eine negative Ganzzahl angegeben, oder index ist größer oder gleich Count.

Beispiele

Im folgenden Beispiel wird das erste Element aus einem 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

Gilt für