Search code examples
c#xamlwinui-3winui

Custom control that is on top of main window


I was just experimenting with winui3 the other day and was wondering is there some way to create a custom control that would behave like for example

<ComboBox />

Like this:

enter image description here

So it goes beyond main window. I know there is a popup control that is fine, but the problem with it is that it stays within main window and does not go on top of it. I was checking of using additional separate window for that but it looks like a bit of too much to create new window every time for custom controls.

Or what is the best way to create like popup controls in winui3? I do not want to use dialogs.

I have tried to use popup but popup stays inside main window.


Solution

  • Setting ShouldConstrainToRootBounds to False should work.

    <Popup ShouldConstrainToRootBounds="False" ... />