ColumnDefinitionCollection.Add(ColumnDefinition) ColumnDefinitionCollection.Add(ColumnDefinition) ColumnDefinitionCollection.Add(ColumnDefinition) ColumnDefinitionCollection.Add(ColumnDefinition) Method

定義

public:
 virtual void Add(System::Windows::Controls::ColumnDefinition ^ value);
public void Add (System.Windows.Controls.ColumnDefinition value);
abstract member Add : System.Windows.Controls.ColumnDefinition -> unit
override this.Add : System.Windows.Controls.ColumnDefinition -> unit
Public Sub Add (value As ColumnDefinition)

參數

value
ColumnDefinition ColumnDefinition ColumnDefinition ColumnDefinition

識別要加入至集合的 ColumnDefinitionIdentifies the ColumnDefinition to add to the collection.

實作

範例

下列範例示範如何使用Add方法來加入ColumnDefinitionColumnDefinitionCollectionThe following example demonstrates how to use the Add method to add a ColumnDefinition to a ColumnDefinitionCollection.

private void addCol(object sender, RoutedEventArgs e) 
{
    colDef1 = new ColumnDefinition();
    grid1.ColumnDefinitions.Add(colDef1);
}
Private Sub addCol(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim colDef1 As New ColumnDefinition
    grid1.ColumnDefinitions.Add(colDef1)
End Sub

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

適用於

另請參閱