ColumnDefinition Class
Definition
Defines column-specific properties that apply to Grid objects.
Equivalent WinUI class: Microsoft.UI.Xaml.Controls.ColumnDefinition.
public ref class ColumnDefinition sealed : DependencyObject
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Controls.IColumnDefinitionStatics, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class ColumnDefinition sealed : DependencyObject
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Static(Windows.UI.Xaml.Controls.IColumnDefinitionStatics, 65536, "Windows.Foundation.UniversalApiContract")]
class ColumnDefinition sealed : DependencyObject
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Controls.IColumnDefinitionStatics), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class ColumnDefinition : DependencyObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Static(typeof(Windows.UI.Xaml.Controls.IColumnDefinitionStatics), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ColumnDefinition : DependencyObject
Public NotInheritable Class ColumnDefinition
Inherits DependencyObject
<ColumnDefinition .../>
- Inheritance
- Attributes
Windows 10 requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Examples
The following example uses three ColumnDefinitionand three RowDefinition s 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>
Constructors
ColumnDefinition() |
Initializes a new instance of the ColumnDefinition class. Equivalent WinUI constructor: Microsoft.UI.Xaml.Controls.ColumnDefinition.ColumnDefinition. |
Properties
ActualWidth |
Gets a value that represents the actual calculated width of a ColumnDefinition. Equivalent WinUI property: Microsoft.UI.Xaml.Controls.ColumnDefinition.ActualWidth. |
Dispatcher |
Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread. Equivalent WinUI property: Microsoft.UI.Xaml.DependencyObject.Dispatcher. (Inherited from DependencyObject) |
MaxWidth |
Gets or sets a value that represents the maximum width of a ColumnDefinition. Equivalent WinUI property: Microsoft.UI.Xaml.Controls.ColumnDefinition.MaxWidth. |
MaxWidthProperty |
Identifies the MaxWidth dependency property. Equivalent WinUI property: Microsoft.UI.Xaml.Controls.ColumnDefinition.MaxWidthProperty. |
MinWidth |
Gets or sets a value that represents the minimum width of a ColumnDefinition. Equivalent WinUI property: Microsoft.UI.Xaml.Controls.ColumnDefinition.MinWidth. |
MinWidthProperty |
Identifies the MinWidth dependency property. Equivalent WinUI property: Microsoft.UI.Xaml.Controls.ColumnDefinition.MinWidthProperty. |
Width |
Gets the calculated width of a ColumnDefinition element, or sets the GridLength value of a column that is defined by the ColumnDefinition. Equivalent WinUI property: Microsoft.UI.Xaml.Controls.ColumnDefinition.Width. |
WidthProperty |
Identifies the Width dependency property. Equivalent WinUI property: Microsoft.UI.Xaml.Controls.ColumnDefinition.WidthProperty. |