UniformGridLayout 類別

定義

在換行版面配置中,依序從左至右或由上至下定位元素。

/// [Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=0)]
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodName(value="OnPropertyChanged")]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Version(1)]
class UniformGridLayout : VirtualizingLayout
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodName(value="OnPropertyChanged")]
/// [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 UniformGridLayout : VirtualizingLayout
[Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=0)]
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodName(value="OnPropertyChanged")]
[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 UniformGridLayout : VirtualizingLayout
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodName(value="OnPropertyChanged")]
[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 UniformGridLayout : VirtualizingLayout
Public Class UniformGridLayout
Inherits VirtualizingLayout
繼承
Object IInspectable DependencyObject Layout VirtualizingLayout UniformGridLayout
屬性
Microsoft.UI.Xaml.CustomAttributes.MUXContractPropertyAttribute Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackMethodNameAttribute MarshalingBehaviorAttribute ThreadingAttribute VersionAttribute ContractVersionAttribute

範例

提示

如需詳細資訊、設計指引和程式碼範例,請參閱 ItemsRepeater

WinUI 3 資源庫應用程式包含大部分 WinUI 3 控制件、特性和功能的互動式範例。 從 Microsoft Store 取得應用程式,或在 GitHub 上取得原始程式碼。

下列範例示範如何將 ItemsRepeater.Layout 屬性設定為 UniformGridLayout。

<!--
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
-->
...
<muxc:ItemsRepeater ItemsSource="{x:Bind Items}"
                    ItemTemplate="{StaticResource MyTemplate}">
    <muxc:ItemsRepeater.Layout>
        <muxc:UniformGridLayout MinItemWidth="200"
                                MinColumnSpacing="28"
                                ItemsJustification="SpaceAround"/>
    </muxc:ItemsRepeater.Layout>
</muxc:ItemsRepeater>

備註

OrientationHorizontal時,會依從左至右的順序配置專案,並在 OrientationVertical時配置由上至下配置。

UniformGridLayout 中的每個專案大小都相同。

當附加至支持虛擬化的主機時,UniformGridLayout 支援虛擬化。

建構函式

UniformGridLayout()

初始化 UniformGridLayout 類別的新實例。

屬性

Dispatcher

一律會在 Windows 應用程式 SDK 應用程式中傳null回 。 請改用 DispatcherQueue

(繼承來源 DependencyObject)
DispatcherQueue

DispatcherQueue取得與這個 物件相關聯的 。 DispatcherQueue表示即使程式代碼是由非UI線程起始,也可以存取 DependencyObject UI線程上的設備。

(繼承來源 DependencyObject)
IndexBasedLayoutOrientation

取得方向,如果有的話,根據專案在來源集合中的索引進行配置。

(繼承來源 Layout)
ItemsJustification

取得或設定值,這個值表示專案如何在非卷動或非虛擬化軸上對齊。

ItemsJustificationProperty

識別 ItemsJustification 相依性屬性。

ItemsStretch

取得或設定值,這個值表示專案的大小如何填滿可用空間。

ItemsStretchProperty

識別 ItemsStretch 相依性屬性。

MaximumRowsOrColumns

根據 UniformGridLayout 的方向,取得或設定根據每個數據列或數據行呈現的項目數目上限。

MaximumRowsOrColumnsProperty

識別 MaximumRowsOrColumns 相依性屬性。

MinColumnSpacing

取得或設定水平軸上項目之間的最小空間。

MinColumnSpacingProperty

識別 MinColumnSpacing 相依性屬性。

MinItemHeight

取得或設定每個專案的最小高度。

MinItemHeightProperty

識別 MinItemHeight 相依性屬性。

MinItemWidth

取得或設定每個專案的最小寬度。

MinItemWidthProperty

識別 MinItemWidth 相依性屬性。

MinRowSpacing

取得或設定垂直軸上項目之間的最小空間。

MinRowSpacingProperty

識別 MinRowSpacing 相依性屬性。

Orientation

取得或設定專案配置所在的座標軸。

OrientationProperty

識別 Orientation 相依性屬性。

方法

Arrange(LayoutContext, Size)

放置子元素,並決定容器 UIElement 的大小。 支援附加配置的容器元素應該從其版面配置覆寫實作呼叫此方法,以形成遞歸版面配置更新。

(繼承來源 Layout)
ArrangeOverride(VirtualizingLayoutContext, Size)

在衍生類別中實作時,提供配置「排列」階段的行為。 類別可以覆寫這個方法,以定義自己的「排列」傳遞行為。

(繼承來源 VirtualizingLayout)
ClearValue(DependencyProperty)

清除相依性屬性的本機值。

(繼承來源 DependencyObject)
CreateDefaultItemTransitionProvider()

在換行版面配置中,依序從左至右或由上至下定位元素。

(繼承來源 Layout)
GetAnimationBaseValue(DependencyProperty)

傳回為相依性屬性建立的任何基底值,如果動畫未使用中,則適用此屬性。

(繼承來源 DependencyObject)
GetValue(DependencyProperty)

DependencyObject 傳回相依性屬性的目前有效值。

(繼承來源 DependencyObject)
InitializeForContext(LayoutContext)

初始化配置附加至 UIElement 容器時所需的任何個別容器狀態。

(繼承來源 Layout)
InitializeForContextCore(VirtualizingLayoutContext)

在衍生類別中覆寫時,初始化配置附加至 UIElement 容器時所需的任何個別容器狀態。

(繼承來源 VirtualizingLayout)
InvalidateArrange()

使參考此配置之所有UIElement容器的排列狀態 (配置) 失效。 在失效之後,UIElement 會更新其版面配置,這會以異步方式發生。

(繼承來源 Layout)
InvalidateMeasure()

使參考此配置之所有UIElement容器的度量狀態 (配置) 失效。

(繼承來源 Layout)
Measure(LayoutContext, Size)

建議容器專案的 DesiredSize。 支援附加配置的容器元素應該從自己的 MeasureOverride 實作呼叫這個方法,以形成遞歸配置更新。 附加的配置預期會呼叫每個容器 UIElement 子系的 Measure。

(繼承來源 Layout)
MeasureOverride(VirtualizingLayoutContext, Size)

提供配置週期的「量值」階段行為。 類別可以覆寫這個方法,以定義自己的「量值」傳遞行為。

(繼承來源 VirtualizingLayout)
OnItemsChangedCore(VirtualizingLayoutContext, Object, NotifyCollectionChangedEventArgs)

當指派給 Container 元素的數據收集 (ItemsSource) 變更時,通知配置。

(繼承來源 VirtualizingLayout)
ReadLocalValue(DependencyProperty)

如果已設定本機值,則傳回相依性屬性的本機值。

(繼承來源 DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

註冊通知函式,以接聽此 DependencyObject 實例上特定 DependencyProperty 的變更。

(繼承來源 DependencyObject)
SetIndexBasedLayoutOrientation(IndexBasedLayoutOrientation)

設定 IndexBasedLayoutOrientation 屬性的值。

(繼承來源 Layout)
SetValue(DependencyProperty, Object)

設定 DependencyObject 上相依性屬性的本機值。

(繼承來源 DependencyObject)
UninitializeForContext(LayoutContext)

拿掉先前儲存在 UIElement 容器上之配置的任何狀態。

(繼承來源 Layout)
UninitializeForContextCore(VirtualizingLayoutContext)

在衍生類別中覆寫時,移除先前儲存在UIElement容器上配置的任何狀態。

(繼承來源 VirtualizingLayout)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

取消先前透過呼叫 RegisterPropertyChangedCallback 註冊的變更通知。

(繼承來源 DependencyObject)

事件

ArrangeInvalidated

發生於配置 () 已失效時。

(繼承來源 Layout)
MeasureInvalidated

發生於 (配置) 的測量狀態已失效時。

(繼承來源 Layout)

適用於

另請參閱