语言

Layout 类

定义

表示大小和排列主机子元素的对象的基类。

public ref class Layout : DependencyObject
/// [Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=0)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Version(1)]
class Layout : DependencyObject
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.XamlContract, 65536)]
class Layout : DependencyObject
[Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=0)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Version(1)]
public class Layout : DependencyObject
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.XamlContract), 65536)]
public class Layout : DependencyObject
Public Class Layout
Inherits DependencyObject
继承
Object Platform::Object IInspectable DependencyObject Layout
派生
属性
Microsoft.UI.Xaml.CustomAttributes.MUXContractPropertyAttribute MarshalingBehaviorAttribute ThreadingAttribute VersionAttribute ContractVersionAttribute

注解

不应直接使用或继承 Layout 类。 而是从其派生类 、NonVirtualizingLayout 或 VirtualizingLayout 继承。

提供的具体布局类是 StackLayout 和 UniformGridLayout。

属性

名称 说明
Dispatcher

始终在 Windows 应用 SDK 应用中返回 null 。 请改用 DispatcherQueue 。

(继承自 DependencyObject)
DispatcherQueue

获取 DispatcherQueue 与此对象关联的对象。 表示 DispatcherQueue 即使代码是由非 UI 线程启动,也可以访问 DependencyObject UI 线程上的设施。

(继承自 DependencyObject)
IndexBasedLayoutOrientation

获取基于源集合中的索引布局项的方向(如果有)。

方法

名称 说明
Arrange(LayoutContext, Size)

定位子元素并确定容器 UIElement 的大小。 支持附加布局的容器元素应从其布局重写实现中调用此方法,以形成递归布局更新。

ClearValue(DependencyProperty)

清除依赖属性的本地值。

(继承自 DependencyObject)
CreateDefaultItemTransitionProvider()

表示大小和排列主机子元素的对象的基类。

GetAnimationBaseValue(DependencyProperty)

返回为依赖属性建立的任何基值,在动画未处于活动状态的情况下,该属性将适用。

(继承自 DependencyObject)
GetValue(DependencyProperty)

从 DependencyObject 返回依赖属性的当前有效值。

(继承自 DependencyObject)
InitializeForContext(LayoutContext)

初始化布局附加到 UIElement 容器时所需的任何每个容器状态。

InvalidateArrange()

使引用此布局的所有 UIElement 容器的排列状态(布局)失效。 失效后,UIElement 将更新其布局,以异步方式发生。

InvalidateMeasure()

使引用此布局的所有 UIElement 容器的度量状态(布局)失效。

Measure(LayoutContext, Size)

建议容器元素的 DesiredSize。 支持附加布局的容器元素应从自己的 MeasureOverride 实现中调用此方法,以形成递归布局更新。 附加布局应为每个容器的 UIElement 子级调用 Measure。

ReadLocalValue(DependencyProperty)

如果设置了本地值,则返回依赖属性的本地值。

(继承自 DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

注册一个通知函数,用于侦听此 DependencyObject 实例上对特定 DependencyProperty 所做的更改。

(继承自 DependencyObject)
SetIndexBasedLayoutOrientation(IndexBasedLayoutOrientation)

设置属性的值 IndexBasedLayoutOrientation 。

SetValue(DependencyProperty, Object)

设置 DependencyObject 上的依赖属性的本地值。

(继承自 DependencyObject)
UninitializeForContext(LayoutContext)

删除以前存储在 UIElement 容器上的布局的任何状态。

UnregisterPropertyChangedCallback(DependencyProperty, Int64)

取消以前通过调用 RegisterPropertyChangedCallback 注册的更改通知。

(继承自 DependencyObject)

事件

名称 说明
ArrangeInvalidated

当排列状态(布局)失效时发生。

MeasureInvalidated

当度量状态(布局)失效时发生。

适用于

另请参阅