Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 2.35 KB

commandbar_defaultlabelposition.md

File metadata and controls

61 lines (41 loc) · 2.35 KB
-api-id -api-type
P:Windows.UI.Xaml.Controls.CommandBar.DefaultLabelPosition
winrt property

Windows.UI.Xaml.Controls.CommandBar.DefaultLabelPosition

-description

Gets or sets a value that indicates the placement and visibility of the labels on the command bar's buttons.

-xaml-syntax

<CommandBar DefaultLabelPosition="commandBarDefaultLabelPositionMemberName" />

-xaml-values

commandBarDefaultLabelPositionMemberName
commandBarDefaultLabelPositionMemberNameA named constant of the CommandBarDefaultLabelPosition enumeration; for example, Right.
## -property-value An enumeration value that indicates the placement and visibility of the labels on the command bar's buttons. The default is **Bottom**.

-remarks

By default, an app bar button's label is displayed below the icon. You can set this property to show labels to the right of the icon, or to hide labels.

You can set the AppBarButton.LabelPosition property to override this value and make the label always collapsed for a specific app bar button.

Version compatibility

The DefaultLabelPosition property is not available prior to Windows 10, version 1607. If your app’s 'minimum platform version' setting in Microsoft Visual Studio is less than the 'introduced version' shown in the Requirements block later in this page, you must design and test your app to account for this. For more info, see Version adaptive code.

To avoid exceptions when your app runs on previous versions of Windows 10, do not set this property in XAML or use it without performing a runtime check. This example shows how to use the ApiInformation class to check for the presence of this property before you set it.

<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;
    }
}

-examples

-see-also