Export (0) Print
Expand All

ColumnDefinitionCollection.Contains Method

Determines whether a given ColumnDefinition exists within a ColumnDefinitionCollection.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)

public bool Contains (
	ColumnDefinition value
)
public final boolean Contains (
	ColumnDefinition value
)
public final function Contains (
	value : ColumnDefinition
) : boolean
You cannot use methods in XAML.

Parameters

value

Identifies the ColumnDefinition that is being tested.

Return Value

true if the ColumnDefinition exists within the collection; otherwise false.

The following example demonstrates how to use the Contains method to determine whether a ColumnDefinition exists in a ColumnDefinitionCollection.

private void containsCol(object sender, RoutedEventArgs e)
{
    if (grid1.ColumnDefinitions.Contains(colDef1))
    {
        tp3.Text = "Grid Contains ColumnDefinition colDef1";
    }
    else
    {
        tp3.Text = "Grid Does Not Contain ColumnDefinition colDef1";
    }
}

To view the complete sample, see Manipulate Columns and Rows using ColumnDefinitionsCollections and RowDefinitionsCollections.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft