ColumnDefinitionCollection.RemoveAt(Int32) ColumnDefinitionCollection.RemoveAt(Int32) ColumnDefinitionCollection.RemoveAt(Int32) ColumnDefinitionCollection.RemoveAt(Int32) Method

定義

ColumnDefinition 的指定索引位置移除 ColumnDefinitionCollectionRemoves a ColumnDefinition from a ColumnDefinitionCollection at the specified index position.

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

參數

index
Int32 Int32 Int32 Int32

要移除之 ColumnDefinition 在集合內的位置。The position within the collection at which the ColumnDefinition is removed.

實作

範例

下列範例示範如何使用RemoveAt方法來移除ColumnDefinitionColumnDefinitionCollection特定index位置。The following example demonstrates how to use the RemoveAt method to remove a ColumnDefinition to a ColumnDefinitionCollection at a specific index position.

private void removeCol(object sender, RoutedEventArgs e)
{
    if (grid1.ColumnDefinitions.Count <= 0)
    {
        tp1.Text = "No More Columns to Remove!";
    }
    else
    {
        grid1.ColumnDefinitions.RemoveAt(0);
    }
}
Private Sub removeCol(ByVal sender As Object, ByVal e As RoutedEventArgs)

    If (grid1.ColumnDefinitions.Count <= 0) Then
        tp1.Text = "No More Columns to Remove!"
    Else
        grid1.ColumnDefinitions.RemoveAt(0)
    End If
End Sub

若要檢視完整的範例,請參閱如何: 操作資料行及資料列使用 ColumnDefinitionsCollections 和 rowdefinitionscollections 管理To view the complete sample, see How to: Manipulate Columns and Rows by Using ColumnDefinitionsCollections and RowDefinitionsCollections.

備註

ColumnDefinitionCollection 使用以零為起始的索引編製系統。ColumnDefinitionCollection uses a zero-based indexing system.

適用於

另請參閱