From ce2641d89be589cb122a428340b817a7f73b4f77 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 3 Feb 2021 07:17:15 -0500 Subject: [PATCH] fix: Set IsVisualTreeRoot flag on all platforms --- src/Uno.UI/UI/Xaml/Window.Android.cs | 1 + src/Uno.UI/UI/Xaml/Window.Desktop.cs | 10 ++++++++++ src/Uno.UI/UI/Xaml/Window.iOS.cs | 1 + src/Uno.UI/UI/Xaml/Window.macOS.cs | 1 + src/Uno.UI/UI/Xaml/Window.wasm.cs | 1 + 5 files changed, 14 insertions(+) diff --git a/src/Uno.UI/UI/Xaml/Window.Android.cs b/src/Uno.UI/UI/Xaml/Window.Android.cs index dc5a5e130f63..7609d01a0ca6 100644 --- a/src/Uno.UI/UI/Xaml/Window.Android.cs +++ b/src/Uno.UI/UI/Xaml/Window.Android.cs @@ -56,6 +56,7 @@ private void InternalSetContent(UIElement value) _main = new Grid() { + IsVisualTreeRoot = true, Children = { _rootBorder, diff --git a/src/Uno.UI/UI/Xaml/Window.Desktop.cs b/src/Uno.UI/UI/Xaml/Window.Desktop.cs index 4170e00e76aa..19f05cea40c7 100644 --- a/src/Uno.UI/UI/Xaml/Window.Desktop.cs +++ b/src/Uno.UI/UI/Xaml/Window.Desktop.cs @@ -31,7 +31,17 @@ partial void InternalActivate() private void InternalSetContent(UIElement value) { + if (_content != null) + { + _content.IsWindowRoot = false; + _content.IsVisualTreeRoot = false; + } + _content = value; + + _content.IsWindowRoot = true; + _content.IsVisualTreeRoot = true; + TryLoadContent(); } diff --git a/src/Uno.UI/UI/Xaml/Window.iOS.cs b/src/Uno.UI/UI/Xaml/Window.iOS.cs index 0ea2f1d4b899..b075701b0451 100644 --- a/src/Uno.UI/UI/Xaml/Window.iOS.cs +++ b/src/Uno.UI/UI/Xaml/Window.iOS.cs @@ -98,6 +98,7 @@ private void InternalSetContent(UIElement value) _main = new Grid() { + IsVisualTreeRoot = true, Children = { _rootBorder, diff --git a/src/Uno.UI/UI/Xaml/Window.macOS.cs b/src/Uno.UI/UI/Xaml/Window.macOS.cs index 31a5a5e3cbb4..368219fd86fa 100644 --- a/src/Uno.UI/UI/Xaml/Window.macOS.cs +++ b/src/Uno.UI/UI/Xaml/Window.macOS.cs @@ -85,6 +85,7 @@ private void InternalSetContent(UIElement value) _main = new Grid() { + IsVisualTreeRoot = true, Children = { _rootBorder, diff --git a/src/Uno.UI/UI/Xaml/Window.wasm.cs b/src/Uno.UI/UI/Xaml/Window.wasm.cs index b316276e7306..32964350251c 100644 --- a/src/Uno.UI/UI/Xaml/Window.wasm.cs +++ b/src/Uno.UI/UI/Xaml/Window.wasm.cs @@ -146,6 +146,7 @@ private void InternalSetContent(UIElement content) _popupRoot = new PopupRoot(); _window = new Grid() { + IsVisualTreeRoot = true, Children = { _rootScrollViewer,