diff --git a/src/Core/src/Core/Extensions/VisualTreeElementExtensions.cs b/src/Core/src/Core/Extensions/VisualTreeElementExtensions.cs index 93bbce1b8afd..0e0424802470 100644 --- a/src/Core/src/Core/Extensions/VisualTreeElementExtensions.cs +++ b/src/Core/src/Core/Extensions/VisualTreeElementExtensions.cs @@ -136,7 +136,12 @@ static List GetVisualTreeElementsWindowsInternal(IVisualTree var visualElements = new List(); if (visualElement is IWindow window) { - uiElement = window.Content?.ToPlatform(); + // Get the UI.Xaml.Window so we catch everything in the app window rather than the frame which doesn't include modal content + var platformView = window.Handler?.PlatformView; + if (platformView is UI.Xaml.Window winUiWindow) + { + uiElement = winUiWindow.Content; + } } else if (visualElement is IView view) {