Skip to content

Commit

Permalink
Fix dropdown showing in up direction (#10009)
Browse files Browse the repository at this point in the history
## Summary of the Pull Request
Let the dropdown menu open downwards if there's enough space, when clicking on the down arrow.

## PR Checklist
* [X] Closes #8924 
* [X] CLA signed.

## Detailed Description of the Pull Request / Additional comments
Set the placement of the flyout to BottomEdgeAlignedLeft, as was done when opening the menu from the key binding.

## Validation Steps Performed
Manual tests
  • Loading branch information
mpela81 committed May 4, 2021
1 parent 7d71b4b commit 2b4c20b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ namespace winrt::TerminalApp::implementation
void TerminalPage::_CreateNewTabFlyout()
{
auto newTabFlyout = WUX::Controls::MenuFlyout{};
newTabFlyout.Placement(WUX::Controls::Primitives::FlyoutPlacementMode::BottomEdgeAlignedLeft);

auto keyBindings = _settings.KeyMap();

const auto defaultProfileGuid = _settings.GlobalSettings().DefaultProfile();
Expand Down Expand Up @@ -713,13 +715,10 @@ namespace winrt::TerminalApp::implementation

// Function Description:
// Called when the openNewTabDropdown keybinding is used.
// Adds the flyout show option to left-align the dropdown with the split button.
// Shows the dropdown flyout.
void TerminalPage::_OpenNewTabDropdown()
{
WUX::Controls::Primitives::FlyoutShowOptions options{};
options.Placement(WUX::Controls::Primitives::FlyoutPlacementMode::BottomEdgeAlignedLeft);
_newTabButton.Flyout().ShowAt(_newTabButton, options);
_newTabButton.Flyout().ShowAt(_newTabButton);
}

winrt::fire_and_forget TerminalPage::_RemoveOnCloseRoutine(Microsoft::UI::Xaml::Controls::TabViewItem tabViewItem, winrt::com_ptr<TerminalPage> page)
Expand Down

0 comments on commit 2b4c20b

Please sign in to comment.