Skip to main content

CommandBarFlyout

Description​

Use CommandBarFlyout for a compact command strip with an overflow menu; commands dismiss the flyout when invoked.

The first images show the open command surface. The closed-state images below show its trigger button.

CommandBarFlyout in light mode CommandBarFlyout in dark mode

Closed trigger​

CommandBarFlyout closed trigger in light mode CommandBarFlyout closed trigger in dark mode

Example usage​

<fluence:Button Content="Commands" Click="ShowFlyoutButton_Click">
<fluence:FlyoutBase.AttachedFlyout>
<fluence:CommandBarFlyout>
<fluence:CommandBarFlyout.PrimaryCommands>
<fluence:AppBarButton Label="Copy" Command="{Binding CopyCommand}" />
</fluence:CommandBarFlyout.PrimaryCommands>
<fluence:CommandBarFlyout.SecondaryCommands>
<fluence:AppBarButton Label="Delete" Command="{Binding DeleteCommand}" />
</fluence:CommandBarFlyout.SecondaryCommands>
</fluence:CommandBarFlyout>
</fluence:FlyoutBase.AttachedFlyout>
</fluence:Button>

In the window or page code-behind:

private void ShowFlyoutButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (sender is System.Windows.FrameworkElement target)
{
Fluence.Wpf.Controls.FlyoutBase.ShowAttachedFlyout(target);
}
}

Bind CopyCommand and DeleteCommand on the page's data context.

Key properties​

PropertyDefaultPurpose
PrimaryCommandsEmpty collectionCommands shown in the primary area.
SecondaryCommandsEmpty collectionCommands shown in the secondary area.
PlacementTopPositions the flyout relative to its target.
ShouldConstrainToRootBoundstrueAccepted for WinUI API compatibility; WPF popup placement does not enforce this value.

State and behavior​

Primary commands appear on the strip; secondary commands appear in overflow.

Parts​

CommandBarFlyoutPresenter​

Description​

CommandBarFlyoutPresenter draws the primary strip and overflow surface of CommandBarFlyout. The screenshots show CommandBarFlyoutPresenter inside CommandBarFlyout.

Use it through CommandBarFlyout when a command strip needs an overflow surface.

The parent control capture above shows this part in context.

Example usage​

<fluence:Button Content="Commands" Click="ShowFlyoutButton_Click">
<fluence:FlyoutBase.AttachedFlyout>
<fluence:CommandBarFlyout>
<fluence:CommandBarFlyout.PrimaryCommands>
<fluence:AppBarButton Label="Copy" Command="{Binding CopyCommand}" />
</fluence:CommandBarFlyout.PrimaryCommands>
<fluence:CommandBarFlyout.SecondaryCommands>
<fluence:AppBarButton Label="Delete" Command="{Binding DeleteCommand}" />
</fluence:CommandBarFlyout.SecondaryCommands>
</fluence:CommandBarFlyout>
</fluence:FlyoutBase.AttachedFlyout>
</fluence:Button>

In the window or page code-behind:

private void ShowFlyoutButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (sender is System.Windows.FrameworkElement target)
{
Fluence.Wpf.Controls.FlyoutBase.ShowAttachedFlyout(target);
}
}

Bind CopyCommand and DeleteCommand on the page's data context.

State and behavior​

The presenter displays command bar content and switches between collapsed and expanded overflow states.

Reference​

Events​

Opening and Opened report opening. Hide() raises Closing, which can be canceled, followed by Closed when the popup closes. The light-dismiss handlers call Hide().

Reference​