RowDefinitionCollection.IndexOf(RowDefinition) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the index position of a given RowDefinition within a RowDefinitionCollection.
public:
virtual int IndexOf(System::Windows::Controls::RowDefinition ^ value);
public int IndexOf(System.Windows.Controls.RowDefinition value);
abstract member IndexOf : System.Windows.Controls.RowDefinition -> int
override this.IndexOf : System.Windows.Controls.RowDefinition -> int
Public Function IndexOf (value As RowDefinition) As Integer
- value
- RowDefinition
The RowDefinition whose index position is desired.
The index of value
if found in the collection; otherwise, -1.
The following example demonstrates how to use the IndexOf method to determine the index position of a RowDefinition within a 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
To view the complete sample, see How to: Manipulate Columns and Rows by Using ColumnDefinitionsCollections and RowDefinitionsCollections.
Продукт | Версии |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
Обратна връзка за .NET
.NET е проект с отворен код. Изберете връзка, за да предоставите обратна връзка: