Skip to content

Commit bce4b14

Browse files
committed
fix: Set XamlRoot on Popup if not set for Uno.UI
1 parent 05f4a57 commit bce4b14

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Uno.UI/UI/Xaml/Controls/Popup/Popup.WithPopupRoot.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ partial void OnIsOpenChangedPartialNative(bool oldIsOpen, bool newIsOpen)
7979
{
8080
if (newIsOpen)
8181
{
82+
#if !HAS_UNO_WINUI
83+
// In UWP, XamlRoot is set automatically to CoreWindow XamlRoot if not set beforehand.
84+
if (XamlRoot is null)
85+
{
86+
XamlRoot = CoreServices.Instance.ContentRootCoordinator.CoreWindowContentRoot.XamlRoot;
87+
}
88+
#endif
89+
8290
#if !__SKIA__ // The OpenPopup method should be moved out of Window in general https://github.com/unoplatform/uno/issues/8978
8391
_closePopup.Disposable = Window.Current.OpenPopup(this);
8492
#else

0 commit comments

Comments
 (0)