Share via


CommandBar.DefaultLabelPosition 屬性

定義

取得或設定值,這個值表示命令行按鈕上標籤的位置和可見度。

public:
 property CommandBarDefaultLabelPosition DefaultLabelPosition { CommandBarDefaultLabelPosition get(); void set(CommandBarDefaultLabelPosition value); };
CommandBarDefaultLabelPosition DefaultLabelPosition();

void DefaultLabelPosition(CommandBarDefaultLabelPosition value);
public CommandBarDefaultLabelPosition DefaultLabelPosition { get; set; }
var commandBarDefaultLabelPosition = commandBar.defaultLabelPosition;
commandBar.defaultLabelPosition = commandBarDefaultLabelPosition;
Public Property DefaultLabelPosition As CommandBarDefaultLabelPosition
<CommandBar DefaultLabelPosition="commandBarDefaultLabelPositionMemberName" />

屬性值

列舉值,表示命令行按鈕上標籤的位置和可見性。 預設值為 Bottom

備註

根據預設,應用程式行按鈕的標籤會顯示在圖示下方。 您可以設定此屬性以顯示圖示右邊的標籤,或隱藏標籤。

您可以設定 AppBarButton.LabelPosition 屬性來覆寫此值,並讓標籤一律折疊特定應用程式行按鈕。

版本相容性

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

若要避免在舊版 Windows 10 上執行您的應用程式時發生例外狀況,請勿在 XAML 中設定此屬性,或在不執行運行時間檢查的情況下使用它。 此範例示範如何使用 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", "DefaultLabelPosition"))
    {
        commandBar1.DefaultLabelPosition = CommandBarDefaultLabelPosition.Right;
    }
}

適用於