Share via


CommandBar.IsDynamicOverflowEnabled 屬性

定義

取得或設定值,這個值表示當空間有限時,主要命令是否會自動移至溢位功能表。

public:
 property bool IsDynamicOverflowEnabled { bool get(); void set(bool value); };
bool IsDynamicOverflowEnabled();

void IsDynamicOverflowEnabled(bool value);
public bool IsDynamicOverflowEnabled { get; set; }
var boolean = commandBar.isDynamicOverflowEnabled;
commandBar.isDynamicOverflowEnabled = boolean;
Public Property IsDynamicOverflowEnabled As Boolean
<CommandBar IsDynamicOverflowEnabled="bool"/>

屬性值

Boolean

bool

如果主要命令在空間有限時自動移至溢位功能表,則為true;否則為false。 預設值為 True

Windows 需求

裝置系列
Windows 10 Anniversary Edition (已於 10.0.14393.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v3.0 引進)

備註

如需詳細資訊和指導方針,請參閱 應用程式行和命令列 一文。

從 Windows 10 1607 版開始,CommandBar引進了動態溢位功能。 根據預設, PrimaryCommands 會在命令列寬度變更時自動移入或移出溢位區域,例如,當使用者調整其應用程式視窗的大小時。 您可以將 IsDynamicOverflowEnabled 屬性設定為 false ,以停用此行為。

動態溢位只會影響命令的 UI 呈現,它不會將命令從PrimaryCommands 集合移至 SecondaryCommands

版本相容性

IsDynamicOverflowEnabled 屬性在 Windows 10 1607 版之前無法使用。 如果您的 App 在 Microsoft Visual Studio 中的「最低平臺版本」設定小於此頁面稍後的 [需求] 區塊中顯示的「引進版本」,您必須設計並測試您的應用程式以考慮此設定。 如需詳細資訊,請參閱 版本調適型程式碼

注意

當您的應用程式編譯Windows 10版本 1607 並在 1607 版 (或更新版本) 上執行時,可以使用動態溢位。 當您的應用程式針對舊版編譯或在舊版上執行時,無法使用動態溢位。

若要避免在舊版Windows 10上執行應用程式時發生例外狀況,請勿在沒有先執行執行時間檢查的情況下使用此屬性。 此範例示範如何使用 ApiInformation 類別來檢查此屬性是否存在,再使用它。

<CommandBar x:Name="commandBar1" Loaded="CommandBar_Loaded">
    ...
</CommandBar>
private void CommandBar_Loaded(object sender, RoutedEventArgs e)
{
    if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.CommandBar", "IsDynamicOverflowEnabled"))
    {
        commandBar1.IsDynamicOverflowEnabled = true;
    }
}

適用於