A stub type - a hack really so that we could show the app object in the visual tree view.
Inheritance: Windows.UI.Xaml.Controls.Control
#pragma warning disable 1998
        private async Task Build()
#pragma warning restore 1998
        {
            this.RootElements.Clear();

            var appResourcesElement = new Stubs.Application();

            this.AppViewModel = new DependencyObjectViewModel(this, null, appResourcesElement);
            this.RootElements.Add(this.AppViewModel);

            var rootElement = VisualTreeHelperExtensions.GetRealWindowRoot();

            if (rootElement != null)
            {
                var ancestors = rootElement.GetAncestors();

                var newRoot = ancestors?.OfType <UIElement>().LastOrDefault();

                if (newRoot != null)
                {
                    rootElement = newRoot;
                }

                this.RootElements.Add(new DependencyObjectViewModel(this, null, rootElement));
            }

            foreach (var popup in VisualTreeHelper.GetOpenPopups(Window.Current))
            {
                this.RootElements.Add(new DependencyObjectViewModel(this, null, popup));
            }
        }
Ejemplo n.º 2
0
#pragma warning disable 1998
        private async Task Build()
#pragma warning restore 1998
        {
            this.RootElements.Clear();

            var appResourcesElement = new Stubs.Application();
            this.AppViewModel = new DependencyObjectViewModel(this, null, appResourcesElement);
            this.RootElements.Add(this.AppViewModel);

            var rootElement = VisualTreeHelperExtensions.GetRealWindowRoot();

            if (rootElement != null)
            {
                var ancestors = rootElement.GetAncestors();

                var newRoot = ancestors?.OfType<UIElement>().LastOrDefault();

                if (newRoot != null)
                {
                    rootElement = newRoot;
                }

                this.RootElements.Add(new DependencyObjectViewModel(this, null, rootElement));
            }

            foreach (var popup in VisualTreeHelper.GetOpenPopups(Window.Current))
            {
                this.RootElements.Add(new DependencyObjectViewModel(this, null, popup));
            }
        }