AppBarButton.DynamicOverflowOrder AppBarButton.DynamicOverflowOrder AppBarButton.DynamicOverflowOrder AppBarButton.DynamicOverflowOrder Property

Definition

Gets or sets the order in which this item is moved to the CommandBar overflow menu.

public : int DynamicOverflowOrder { get; set; }
int32_t DynamicOverflowOrder();

void DynamicOverflowOrder(int32_t dynamicoverfloworder);
public int DynamicOverflowOrder { get; set; }
Public ReadWrite Property DynamicOverflowOrder As int
<AppBarButton DynamicOverflowOrder="int" .../>

Property Value

int int

The order in which this item is moved to the overflow menu relative to other items.

Additional features and requirements

Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Remarks

For more info and guidelines, see the App bar and command bar article.

Starting in Windows 10, version 1607, CommandBar introduces a dynamic overflow feature. By default, PrimaryCommands automatically move in or out of the overflow area as the command bar width changes, for example, when users resize their app window. You can set the IsDynamicOverflowEnabled property to false to disable this behavior.

Dynamic overflow affects only the UI presentation of the commands, it doesn’t move commands from the PrimaryCommands collection to SecondaryCommands.

This property has an effect only when this element is in the CommandBar.PrimaryCommands collection and CommandBar.IsDynamicOverflowEnabled is true.

You can assign the same DynamicOverflowOrder value to more than one element. Elements with the same value move in and out of the overflow area at the same time.

Version compatibility

The DynamicOverflowOrder 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.

Note

Dynamic overflow is available when your app is compiled for Windows 10, version 1607 and running on version 1607 (or later). Dynamic overflow is not available when your app is compiled for a previous version or is running on a previous version.

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">
    <AppBarButton x:Name="appBarButtonCut" Icon="Cut" Label="Cut"/>
    <AppBarButton x:Name="appBarButtonCopy" Icon="Copy" Label="Copy"/>
    <AppBarSeparator x:Name="appBarSeparator1"/>
    <AppBarButton x:Name="appBarButtonPaste" Icon="Paste" Label="Paste"/>
</CommandBar>
private void CommandBar_Loaded(object sender, RoutedEventArgs e)
{
    if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.AppBarButton", "DynamicOverflowOrder"))
    {
        commandBar1.IsDynamicOverflowEnabled = true;
        appBarButtonCut.DynamicOverflowOrder = 1;
        appBarButtonCopy.DynamicOverflowOrder = 2;
        appBarSeparator1.DynamicOverflowOrder = 2;
        appBarButtonPaste.DynamicOverflowOrder = 3;
    }
}