microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.35k stars 677 forks source link

Flyout closes when opening the combo box, which is loaded inside the flyout. #8578

Open SreemonPremkumarMuthukrishnan opened 1 year ago

SreemonPremkumarMuthukrishnan commented 1 year ago

Describe the bug

I have a button with a flyout that is loaded by a combo box. When I open the flyout and click on the empty areas within the flyout, then attempt to open the combo box, the flyout gets closed.

 private void buttonWithFlyout_Click(object sender, RoutedEventArgs e)
 {
     Grid grid = new Grid() { Background = new SolidColorBrush(Colors.LightGreen)};
     ComboBox comboBox = new ComboBox() { Width = 130, Height = 40, ItemsSource = new List<string>() { "Item1", "Item2", "Item3", "Item4"}, Margin = new Thickness(40,60,40,60) };
     ComboBox comboBox1 = new ComboBox() { Width = 120, Height = 40, ItemsSource = new List<string>() { "Item1", "Item2", "Item3", "Item4"}, Margin = new Thickness(40,120,40,60) };
     grid.Children.Add(comboBox);
     grid.Children.Add(comboBox1);
     flyoutControl.Content = grid;

     flyoutControl.ShowAt(this.buttonControl);
 }

Steps to reproduce the bug

  1. Declare a button.
  2. Declare a flyout for the button, and add combo box inside the flyout.
  3. Run the application and click the button.
  4. Click on the black spaces within the flyout, and then click on the combo box.

Note: Some collection must be bind to the ItemSource of the combo box. This bug does not replicated when combo box collection was empty.

Observed behavior: The flyout gets closed.

Expected behavior

The flyout should not be closed.

Screenshots

https://github.com/microsoft/microsoft-ui-xaml/assets/104507189/983417cb-5ede-4ded-a0c8-66511562e15a

NuGet package version

WinUI 3 - Windows App SDK 1.3.2: 1.3.230602002

Windows version

Windows 11 (21H2): Build 22000

Additional context

No response

ritt-app commented 1 month ago

This problem is still observed for Windows App SDK 1.6. It's a minor issue but quite annoying!