ColumnDefinitionCollection.Insert(Int32, ColumnDefinition) メソッド
定義
ColumnDefinition 内の指定されたインデックス位置に、ColumnDefinitionCollection を挿入します。Inserts a ColumnDefinition at the specified index position within a ColumnDefinitionCollection.
public:
virtual void Insert(int index, System::Windows::Controls::ColumnDefinition ^ value);
public void Insert (int index, System.Windows.Controls.ColumnDefinition value);
abstract member Insert : int * System.Windows.Controls.ColumnDefinition -> unit
override this.Insert : int * System.Windows.Controls.ColumnDefinition -> unit
Public Sub Insert (index As Integer, value As ColumnDefinition)
パラメーター
- index
- Int32
コレクション内での項目の挿入位置。The position within the collection where the item is inserted.
- value
- ColumnDefinition
挿入する ColumnDefinition。The ColumnDefinition to insert.
実装
例外
例
次の例は、メソッドを使用して、内の特定の位置にを挿入する方法を示して Insert ColumnDefinition index
ColumnDefinitionCollection います。The following example demonstrates how to use the Insert method to insert a ColumnDefinition to a specific index
position within a ColumnDefinitionCollection.
private void insertColAt(object sender, RoutedEventArgs e)
{
colDef1 = new ColumnDefinition();
grid1.ColumnDefinitions.Insert(grid1.ColumnDefinitions.Count, colDef1);
tp2.Text = "ColumnDefinition added at index position " + grid1.ColumnDefinitions.IndexOf(colDef1).ToString();
}
Private Sub insertColAt(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim colDef1 As New ColumnDefinition()
grid1.ColumnDefinitions.Insert(grid1.ColumnDefinitions.Count, colDef1)
tp2.Text = "ColumnDefinition added at index position " + grid1.ColumnDefinitions.IndexOf(colDef1).ToString()
End Sub
完全なサンプルを表示するには、「 方法: ColumnDefinitionsCollections と RowDefinitionsCollections を使用して列と行を操作する」を参照してください。To view the complete sample, see How to: Manipulate Columns and Rows by Using ColumnDefinitionsCollections and RowDefinitionsCollections.
注釈
ColumnDefinitionCollection 0から始まるインデックスシステムを使用します。ColumnDefinitionCollection uses a zero-based indexing system.