Exemple #1
0
        /// <summary>
        /// See INavigatorImpl.FindRootViewer().
        /// </summary>
        internal static Visual FindRootViewer(ContentControl navigator, string contentPresenterName)
        {
            object content = navigator.Content;

            if (content == null || content is Visual)
            {
                return(content as Visual);
            }

            ContentPresenter cp = null;

            if (navigator.Template != null)
            {
                cp = (ContentPresenter)navigator.Template.FindName(contentPresenterName, navigator);
            }

            // If null, either <contentPresenterName> is not defined in the current template or the template
            // has not been applied yet.
            if (cp == null || cp.InternalVisualChildrenCount == 0 /*Layout not done yet*/)
            {
                return(null);
            }
            Visual v = cp.InternalGetVisualChild(0);

            return(v);
        }
        // Token: 0x060079B0 RID: 31152 RVA: 0x00227B44 File Offset: 0x00225D44
        internal static Visual FindRootViewer(ContentControl navigator, string contentPresenterName)
        {
            object content = navigator.Content;

            if (content == null || content is Visual)
            {
                return(content as Visual);
            }
            ContentPresenter contentPresenter = null;

            if (navigator.Template != null)
            {
                contentPresenter = (ContentPresenter)navigator.Template.FindName(contentPresenterName, navigator);
            }
            if (contentPresenter == null || contentPresenter.InternalVisualChildrenCount == 0)
            {
                return(null);
            }
            return(contentPresenter.InternalGetVisualChild(0));
        }