UIElementCollection.RemoveAt(Int32) Metod

Definition

UIElement Tar bort vid det angivna indexet.

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)

Parametrar

index
Int32

Indexet för det UIElement som du vill ta bort.

Implementeringar

Exempel

I följande exempel används metoden för att ta bort underordnat RemoveAt innehåll vid en angiven indexposition.

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);
    }
}

Gäller för