Defines column-specific properties that apply to Grid objects.
Inheritance
- Object
- DependencyObject
- ColumnDefinition
Syntax
<ColumnDefinition .../>
Attributes
- ActivatableAttribute(NTDDI_WIN8)
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.UI.Xaml.Controls.IColumnDefinitionStatics, NTDDI_WIN8)
- ThreadingAttribute(Both)
- VersionAttribute(NTDDI_WIN8)
- WebHostHiddenAttribute()
Members
The ColumnDefinition class has these types of members:
Constructors
The ColumnDefinition class has these constructors.
| Constructor | Description |
|---|---|
| ColumnDefinition | Initializes a new instance of the ColumnDefinition class. |
Methods
The ColumnDefinition class has these methods. It also inherits methods from the Object class.
| Method | Description |
|---|---|
| ClearValue | Clears the local value of a dependency property. (Inherited from DependencyObject) |
| GetAnimationBaseValue | Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject) |
| GetValue | Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject) |
| ReadLocalValue | Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject) |
| SetValue | Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject) |
Properties
The ColumnDefinition class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets a value that represents the actual calculated width of a ColumnDefinition. | |
| Read-only | Gets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject) | |
| Read/write | Gets or sets a value that represents the maximum width of a ColumnDefinition. | |
| Read-only | Identifies the MaxWidth dependency property. | |
| Read/write | Gets or sets a value that represents the minimum width of a ColumnDefinition. | |
| Read-only | Identifies the MinWidth dependency property. | |
| Read/write | Gets the calculated width of a ColumnDefinition element, or sets the GridLength value of a column that is defined by the ColumnDefinition. | |
| Read-only | Identifies the Width dependency property. |
Examples
The following example uses three ColumnDefinitions and three RowDefinitions to create a grid that has nine cells, such as in a worksheet. Each cell contains a TextBlock element that represents data, and the top row contains a TextBlock with the ColumnSpan property applied.
<Grid VerticalAlignment="Top" HorizontalAlignment="Left" Width="350" Height="200"> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold" Grid.ColumnSpan="3" Grid.Row="0">Expenses for 2007</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" FontWeight="Bold" Grid.Row="1" Grid.Column="0">Travel</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" FontWeight="Bold" Grid.Row="1" Grid.Column="1">Office Supplies</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" FontWeight="Bold" Grid.Row="1" Grid.Column="2">Salary</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Grid.Column="0">20000</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Grid.Column="1">10000</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Grid.Column="2">50000</TextBlock> <TextBlock FontSize="16" FontWeight="Bold" Grid.ColumnSpan="3" Grid.Row="3">Total Expense: 80000</TextBlock> </Grid>
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 3/12/2013