ColumnDefinition 类

定义

定义 Grid 中的列的属性的 IDefinition

public ref class ColumnDefinition sealed : Microsoft::Maui::Controls::BindableObject, Microsoft::Maui::Controls::IDefinition, Microsoft::Maui::IGridColumnDefinition
public sealed class ColumnDefinition : Microsoft.Maui.Controls.BindableObject, Microsoft.Maui.Controls.IDefinition, Microsoft.Maui.IGridColumnDefinition
type ColumnDefinition = class
    inherit BindableObject
    interface IDefinition
    interface IGridColumnDefinition
Public NotInheritable Class ColumnDefinition
Inherits BindableObject
Implements IDefinition, IGridColumnDefinition
继承
ColumnDefinition
实现

注解

以下示例演示如何将三列宽度设置为三个有效 GridUnitType 值中的每一个:

<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>

构造函数

ColumnDefinition()

新建具有默认值的 ColumnDefinition 对象。

ColumnDefinition(GridLength)

定义 Grid 中的列的属性的 IDefinition

字段

WidthProperty

Width可绑定属性。

属性

BindingContext

获取或设置一个 对象,该对象包含将由属于此 BindableObject的绑定属性所面向的属性。 这是一种可绑定属性。

(继承自 BindableObject)
Dispatcher

获取创建此可绑定对象时可用的调度程序,否则会尝试查找最接近的可用调度程序 (可能是窗口/应用的) 。

(继承自 BindableObject)
Width

获取或设置列的宽度。

方法

ApplyBindings()

将所有当前绑定应用于 BindingContext

(继承自 BindableObject)
ClearValue(BindableProperty)

清除以前为可绑定属性设置的任何值。

(继承自 BindableObject)
ClearValue(BindablePropertyKey)

清除以前为其键标识的可绑定属性设置的任何值。

(继承自 BindableObject)
CoerceValue(BindableProperty)

强制指定可绑定属性的值。 这是通过调用 BindableProperty.CoerceValueDelegate 指定的可绑定属性来完成的。

(继承自 BindableObject)
CoerceValue(BindablePropertyKey)

强制指定可绑定属性的值。 这是通过调用 BindableProperty.CoerceValueDelegate 指定的可绑定属性来完成的。

(继承自 BindableObject)
GetValue(BindableProperty)

返回给定的可绑定属性中包含的值。

(继承自 BindableObject)
IsSet(BindableProperty)

确定是否存在可绑定属性以及是否设置了值。

(继承自 BindableObject)
OnBindingContextChanged()

引发 BindingContextChanged 事件。

(继承自 BindableObject)
OnPropertyChanged(String)

引发 PropertyChanged 事件。

(继承自 BindableObject)
OnPropertyChanging(String)

引发 PropertyChanging 事件。

(继承自 BindableObject)
RemoveBinding(BindableProperty)

从可绑定属性中删除以前设置的绑定。

(继承自 BindableObject)
SetBinding(BindableProperty, BindingBase)

将绑定分配给可绑定属性。

(继承自 BindableObject)
SetValue(BindableProperty, Object)

设置指定的可绑定属性的值。

(继承自 BindableObject)
SetValue(BindablePropertyKey, Object)

设置指定的可绑定属性的值。

(继承自 BindableObject)
SetValueCore(BindableProperty, Object, SetValueFlags)

供 Microsoft.Maui.Controls 平台内部使用。

(继承自 BindableObject)
UnapplyBindings()

从当前上下文中删除所有当前绑定。

(继承自 BindableObject)

事件

BindingContextChanged

BindingContext 属性的值更改时发生。

(继承自 BindableObject)
PropertyChanged

在属性值更改时发生。

(继承自 BindableObject)
PropertyChanging

在属性值更改时发生。

(继承自 BindableObject)
SizeChanged

定义 Grid 中的列的属性的 IDefinition

显式接口实现

IDynamicResourceHandler.SetDynamicResource(BindableProperty, String)

定义 Grid 中的列的属性的 IDefinition

(继承自 BindableObject)

扩展方法

GetPropertyIfSet<T>(BindableObject, BindableProperty, T)

定义 Grid 中的列的属性的 IDefinition

SetAppTheme<T>(BindableObject, BindableProperty, T, T)

定义 Grid 中的列的属性的 IDefinition

SetAppThemeColor(BindableObject, BindableProperty, Color, Color)

定义 Grid 中的列的属性的 IDefinition

SetBinding(BindableObject, BindableProperty, String, BindingMode, IValueConverter, String)

创建绑定并将其应用到属性。

适用于