UIElementCollection.RemoveAt(Int32) Metoda

Definicja

Usuwa element UIElement w określonym indeksie.

public:
 virtual void RemoveAt(int index);
public virtual void RemoveAt (int index);
abstract member RemoveAt : int -> unit
override this.RemoveAt : int -> unit
Public Overridable Sub RemoveAt (index As Integer)

Parametry

index
Int32

Indeks UIElement , który chcesz usunąć.

Implementuje

Przykłady

W poniższym przykładzie RemoveAt użyto metody , aby usunąć zawartość podrzędną na określonej pozycji indeksu.

void RemoveButton(object sender, MouseButtonEventArgs e)
{
    if ((sp1.Children.IndexOf(btn) >= 0) || (sp1.Children.IndexOf(btn1) >= 0) || (sp1.Children.IndexOf(btn2) >= 0) || (sp1.Children.IndexOf(btn3) >= 0))
    {
        sp1.Children.RemoveAt(0);
    }
}

Dotyczy