xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="columndefinitions_grid.Window1" Title="ColumnDefinitions Sample"> Grid Column and Row Collections
//File:Window.xaml.vb Imports System Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Documents Namespace columndefinitions_grid Public Partial Class Window1 Inherits Window Private rowDef1 As RowDefinition Private colDef1 As ColumnDefinition Private Sub containsCol(sender As Object, e As RoutedEventArgs) colDef1 = New ColumnDefinition() grid1.ColumnDefinitions.Insert(grid1.ColumnDefinitions.Count, colDef1) Console.WriteLine(grid1.ColumnDefinitions.IndexOf(colDef1).ToString()) If grid1.ColumnDefinitions.Contains(colDef1) Then Console.WriteLine("Grid Contains ColumnDefinition colDef1") Else Console.WriteLine("Grid Does Not Contain ColumnDefinition colDef1") End If End Sub End Class End Namespace