diff --git a/dev/CommandBarFlyout/CommandBarFlyout.cpp b/dev/CommandBarFlyout/CommandBarFlyout.cpp index a32160a60d..c8df85189a 100644 --- a/dev/CommandBarFlyout/CommandBarFlyout.cpp +++ b/dev/CommandBarFlyout/CommandBarFlyout.cpp @@ -125,10 +125,24 @@ CommandBarFlyout::CommandBarFlyout() // In that circumstance, we want to have the flyout be open from the start. winrt::IFlyoutBase5 thisAsFlyoutBase5 = *this; - // If we don't have IFlyoutBase5 available, then we assume a standard show mode. - if (!thisAsFlyoutBase5 || thisAsFlyoutBase5.ShowMode() == winrt::FlyoutShowMode::Standard) + if (auto commandBar = m_commandBar.get()) { - m_commandBar.get().IsOpen(true); + // If we don't have IFlyoutBase5 available, then we assume a standard show mode. + if (!thisAsFlyoutBase5 || thisAsFlyoutBase5.ShowMode() == winrt::FlyoutShowMode::Standard) + { + commandBar.IsOpen(true); + } + + // When CommandBarFlyout is in AlwaysOpen state, don't show the overflow button + if (AlwaysExpanded()) + { + commandBar.IsOpen(true); + commandBar.OverflowButtonVisibility(winrt::Windows::UI::Xaml::Controls::CommandBarOverflowButtonVisibility::Collapsed); + } + else + { + commandBar.OverflowButtonVisibility(winrt::Windows::UI::Xaml::Controls::CommandBarOverflowButtonVisibility::Auto); + } } } }); diff --git a/dev/CommandBarFlyout/CommandBarFlyout.h b/dev/CommandBarFlyout/CommandBarFlyout.h index d34690ef86..fe64738efd 100644 --- a/dev/CommandBarFlyout/CommandBarFlyout.h +++ b/dev/CommandBarFlyout/CommandBarFlyout.h @@ -13,6 +13,9 @@ class CommandBarFlyout : CommandBarFlyout(); ~CommandBarFlyout(); + bool AlwaysExpanded() { return m_alwaysExpanded; } + void AlwaysExpanded(bool value) { m_alwaysExpanded = value; } + winrt::IObservableVector PrimaryCommands(); winrt::IObservableVector SecondaryCommands(); @@ -25,6 +28,8 @@ class CommandBarFlyout : private: void SetSecondaryCommandsToCloseWhenExecuted(); + bool m_alwaysExpanded; + winrt::IObservableVector m_primaryCommands{ nullptr }; winrt::IObservableVector m_secondaryCommands{ nullptr }; diff --git a/dev/CommandBarFlyout/CommandBarFlyout.idl b/dev/CommandBarFlyout/CommandBarFlyout.idl index 5800eb8b76..355c33444a 100644 --- a/dev/CommandBarFlyout/CommandBarFlyout.idl +++ b/dev/CommandBarFlyout/CommandBarFlyout.idl @@ -8,6 +8,11 @@ unsealed runtimeclass CommandBarFlyout : Windows.UI.Xaml.Controls.Primitives.Fly { CommandBarFlyout(); + [MUX_PREVIEW] + { + Boolean AlwaysExpanded{ get; set; }; + } + Windows.Foundation.Collections.IObservableVector PrimaryCommands { get; }; Windows.Foundation.Collections.IObservableVector SecondaryCommands { get; }; }; diff --git a/dev/CommandBarFlyout/CommandBarFlyout.xaml b/dev/CommandBarFlyout/CommandBarFlyout.xaml index df4d4e9d79..8b6eb6b355 100644 --- a/dev/CommandBarFlyout/CommandBarFlyout.xaml +++ b/dev/CommandBarFlyout/CommandBarFlyout.xaml @@ -356,7 +356,7 @@ contract7NotPresent:CornerRadius="{ThemeResource OverlayCornerRadius}"> - + ("Show CommandBarFlyout with AlwaysExpanded"); + + Log.Comment("Tapping on a button to show the CommandBarFlyout."); + showCommandBarFlyoutButton.InvokeAndWait(); + + Log.Comment("Verifying that the secondary commands are visible."); + Button undoButton = FindElement.ById