CommandBarFlyout Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a specialized flyout that provides layout for AppBarButton, AppBarToggleButton, and AppBarSeparator controls.
/// [Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=7)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Version(1)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="PrimaryCommands")]
class CommandBarFlyout : FlyoutBase
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.UI.Xaml.Markup.ContentProperty(Name="PrimaryCommands")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.XamlContract, 65536)]
class CommandBarFlyout : FlyoutBase
[Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=7)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Version(1)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="PrimaryCommands")]
public class CommandBarFlyout : FlyoutBase
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.UI.Xaml.Markup.ContentProperty(Name="PrimaryCommands")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.XamlContract), 65536)]
public class CommandBarFlyout : FlyoutBase
Public Class CommandBarFlyout
Inherits FlyoutBase
<CommandBarFlyout .../>
-or-
<CommandBarFlyout>
commandBarElements
</CommandBarFlyout>
- Inheritance
- Derived
- Attributes
-
Microsoft.UI.Xaml.CustomAttributes.MUXContractPropertyAttribute MarshalingBehaviorAttribute ThreadingAttribute VersionAttribute ContentPropertyAttribute ContractVersionAttribute
Examples
Tip
For more info, design guidance, and code examples, see Command bar flyout.
The WinUI 3 Gallery app includes interactive examples of most WinUI 3 controls, features, and functionality. Get the app from the Microsoft Store or get the source code on GitHub
Remarks
You can add other controls to a CommandBarFlyout by wrapping them in an AppBarElementContainer. This includes controls such as DropDownButton or SplitButton, or containers like StackPanel for more complex UI.
Control style and template
You can modify the default Style and ControlTemplate to give the control a unique appearance. For information about modifying a control's style and template, see XAML styles. The default style, template, and resources that define the look of the control are included in the generic.xaml
file. For design purposes, generic.xaml
is installed with the Windows App SDK NuGet package. By default, this location is \Users\<username>\.nuget\packages\microsoft.windowsappsdk\<version>\lib\uap10.0\Microsoft.UI\Themes\generic.xaml
. Styles and resources from different versions of the SDK might have different values.
XAML also includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. Modifying these resources is preferred to setting properties such as Background and Foreground. For more info, see the Light-weight styling section of the XAML styles article.
Constructors
CommandBarFlyout() |
Initializes a new instance of the CommandBarFlyout class. |
Properties
AllowFocusOnInteraction |
Gets or sets a value that indicates whether the element automatically gets focus when the user interacts with it. (Inherited from FlyoutBase) |
AllowFocusWhenDisabled |
Gets or sets a value that specifies whether the control can receive focus when it's disabled. (Inherited from FlyoutBase) |
AlwaysExpanded |
Gets or sets a value that indicates whether or not the CommandBarFlyout should always stay in its Expanded state and block the user from entering the Collapsed state. Defaults to false. |
AreOpenCloseAnimationsEnabled |
Gets or sets a value that indicates whether animations are played when the flyout is opened or closed. (Inherited from FlyoutBase) |
Dispatcher |
Always returns |
DispatcherQueue |
Gets the |
ElementSoundMode |
Gets or sets a value that specifies the control's preference for whether it plays sounds. (Inherited from FlyoutBase) |
InputDevicePrefersPrimaryCommands |
Gets a value that indicates whether the input device used to open the flyout does not easily open the secondary commands. (Inherited from FlyoutBase) |
IsConstrainedToRootBounds |
Gets a value that indicates whether the flyout is shown within the bounds of the XAML root. This property is always true for Windows App SDK apps. (Inherited from FlyoutBase) |
IsOpen |
Gets a value that indicates whether the flyout is open. (Inherited from FlyoutBase) |
LightDismissOverlayMode |
Gets or sets a value that specifies whether the area outside of a light-dismiss UI is darkened. (Inherited from FlyoutBase) |
OverlayInputPassThroughElement |
Gets or sets an element that should receive pointer input events even when underneath the flyout's overlay. (Inherited from FlyoutBase) |
Placement |
Gets or sets the default placement to be used for the flyout, in relation to its placement target. (Inherited from FlyoutBase) |
PrimaryCommands |
Gets the collection of primary command elements for the CommandBarFlyout. |
SecondaryCommands |
Gets the collection of secondary command elements for the CommandBarFlyout. |
ShouldConstrainToRootBounds |
Gets or sets a value that indicates whether the flyout should be shown within the bounds of the XAML root. (Inherited from FlyoutBase) |
ShowMode |
Gets or sets a value that indicates how a flyout behaves when shown. (Inherited from FlyoutBase) |
SystemBackdrop |
Gets or sets the system backdrop to apply to this flyout. The backdrop is rendered behind the flyout content. (Inherited from FlyoutBase) |
Target |
Gets the element to use as the flyout's placement target. (Inherited from FlyoutBase) |
XamlRoot |
Gets or sets the XamlRoot in which this flyout is being viewed. (Inherited from FlyoutBase) |
Methods
ClearValue(DependencyProperty) |
Clears the local value of a dependency property. (Inherited from DependencyObject) |
CreatePresenter() |
When overridden in a derived class, initializes a control to show the flyout content as appropriate for the derived control. Note: This method has no base class implementation and must be overridden in a derived class. (Inherited from FlyoutBase) |
GetAnimationBaseValue(DependencyProperty) |
Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject) |
GetValue(DependencyProperty) |
Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject) |
Hide() |
Closes the flyout. (Inherited from FlyoutBase) |
OnProcessKeyboardAccelerators(ProcessKeyboardAcceleratorEventArgs) |
Called just before a keyboard shortcut (accelerator) is processed in your app. Invoked whenever application code or internal processes call ProcessKeyboardAccelerators. Override this method to influence the default accelerator handling. (Inherited from FlyoutBase) |
ReadLocalValue(DependencyProperty) |
Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject) |
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback) |
Registers a notification function for listening to changes to a specific DependencyProperty on this DependencyObject instance. (Inherited from DependencyObject) |
SetValue(DependencyProperty, Object) |
Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject) |
ShowAt(DependencyObject, FlyoutShowOptions) |
Shows the flyout placed in relation to the specified element using the specified options. (Inherited from FlyoutBase) |
ShowAt(FrameworkElement) |
Shows the flyout placed in relation to the specified element. (Inherited from FlyoutBase) |
TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs) |
Attempts to invoke a keyboard shortcut (accelerator). (Inherited from FlyoutBase) |
UnregisterPropertyChangedCallback(DependencyProperty, Int64) |
Cancels a change notification that was previously registered by calling RegisterPropertyChangedCallback. (Inherited from DependencyObject) |
Events
Closed |
Occurs when the flyout is hidden. (Inherited from FlyoutBase) |
Closing |
Occurs when the flyout starts to be hidden. (Inherited from FlyoutBase) |
Opened |
Occurs when the flyout is shown. (Inherited from FlyoutBase) |
Opening |
Occurs before the flyout is shown. (Inherited from FlyoutBase) |