ColumnDefinitionCollection.IndexOf(ColumnDefinition) メソッド
定義
ColumnDefinition 内の指定された ColumnDefinitionCollection のインデックス位置を返します。Returns the index position of a given ColumnDefinition within a ColumnDefinitionCollection.
public:
virtual int IndexOf(System::Windows::Controls::ColumnDefinition ^ value);
public int IndexOf (System.Windows.Controls.ColumnDefinition value);
abstract member IndexOf : System.Windows.Controls.ColumnDefinition -> int
override this.IndexOf : System.Windows.Controls.ColumnDefinition -> int
Public Function IndexOf (value As ColumnDefinition) As Integer
パラメーター
- value
- ColumnDefinition
目的のインデックス位置を持つ ColumnDefinition。The ColumnDefinition whose index position is desired.
戻り値
コレクションに存在する場合は value
のインデックス。それ以外の場合は -1。The index of value
if found in the collection; otherwise, -1.
実装
例
次の例は、メソッドを使用して IndexOf 内ののインデックス位置を確認する方法を示して ColumnDefinition ColumnDefinitionCollection います。The following example demonstrates how to use the IndexOf method to determine the index position of a ColumnDefinition 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.