UIElementCollection.Item[Int32] Property

Definition

Gets or sets the UIElement stored at the zero-based index position of the UIElementCollection.

C#
public virtual System.Windows.UIElement this[int index] { get; set; }

Parameters

index
Int32

The index position of the UIElement.

Property Value

A UIElement at the specified index position.

Examples

The following example uses the Item[] property to identify the child element at a specified index position.

C#
void GetItem(object sender, RoutedEventArgs e)
{
    TextBlock txt2 = new TextBlock();
    sp1.Children.Add(txt2);
    txt2.Text = "UIElement at Index position [0] is " + sp1.Children[0].ToString();
}

Applies to

Производ Верзије
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10