Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Silverlight 3
Grid Class
Grid Properties
 ColumnDefinitions Property
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Silverlight 3

Other versions are also available for the following:
.NET Framework Class Library for Silverlight
Grid..::.ColumnDefinitions Property

Gets a ColumnDefinitionCollection defined on this instance of Grid.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
Public ReadOnly Property ColumnDefinitions As ColumnDefinitionCollection
    Get
Visual Basic (Usage)
Dim instance As Grid
Dim value As ColumnDefinitionCollection

value = instance.ColumnDefinitions
C#
public ColumnDefinitionCollection ColumnDefinitions { get; }
XAML Property Element Usage
<grid>
  <grid.ColumnDefinitions>
    oneOrMoreColumnDefinitions
  </grid.ColumnDefinitions>
</grid>

XAML Values

oneOrMoreColumnDefinitions

One or more ColumnDefinition elements. Each such ColumnDefinition becomes a placeholder representing a column in the final grid layout.

The ColumnDefinitionCollection contains the ColumnDefinition objects that define each column of the grid available for positioning elements.

If a child element is added to a column within a Grid, and the column has its Width property set to Auto, the child will be measured without restrictions. This behavior can prevent horizontal scroll bars from displaying if a ScrollViewer is being used, as the child element is measured as unbounded. For purposes of display, the child is clipped instead of scrolled.

When setting this property in XAML, do not include an explicit ColumnDefinitionCollection object element. Instead use implicit collection syntax. For more information, see the Remarks section in ColumnDefinitionCollection.

NoteNote:

By default, a grid contains one row and one column.

The following example creates a Grid with two columns using ColumnDefinitions.

XAML
<Grid.ColumnDefinitions>
    <ColumnDefinition Width="250" />
    <ColumnDefinition Width="150" />
</Grid.ColumnDefinitions>

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker