RowDefinitionCollection.Insert(Int32, RowDefinition) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Infogar en RowDefinition vid den angivna indexpositionen inom en RowDefinitionCollection.
public:
virtual void Insert(int index, System::Windows::Controls::RowDefinition ^ value);
public void Insert(int index, System.Windows.Controls.RowDefinition value);
abstract member Insert : int * System.Windows.Controls.RowDefinition -> unit
override this.Insert : int * System.Windows.Controls.RowDefinition -> unit
Public Sub Insert (index As Integer, value As RowDefinition)
Parametrar
- index
- Int32
Positionen i samlingen där objektet infogas.
- value
- RowDefinition
Infoga RowDefinition .
Implementeringar
Undantag
index är inte ett giltigt index i IList.
Exempel
I följande exempel visas hur du använder Insert metoden för att infoga en RowDefinition till en viss index position inom en RowDefinitionCollection.
private void insertRowAt(object sender, RoutedEventArgs e)
{
rowDef1 = new RowDefinition();
grid1.RowDefinitions.Insert(grid1.RowDefinitions.Count, rowDef1);
tp1.Text = "RowDefinition added at index position " + grid1.RowDefinitions.IndexOf(rowDef1).ToString();
}
Private Sub insertRowAt(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim rowDef1 As New RowDefinition
grid1.RowDefinitions.Insert(grid1.RowDefinitions.Count, rowDef1)
tp1.Text = "RowDefinition added at index position " + grid1.RowDefinitions.IndexOf(rowDef1).ToString()
End Sub
Information om hur du visar det fullständiga exemplet finns i Ändra kolumner och rader med Hjälp av ColumnDefinitionsCollections och RowDefinitionsCollections.
Kommentarer
RowDefinitionCollection använder ett nollbaserat indexeringssystem.