ICSharpCode.WpfDesign.Designer.Xaml.XamlDesignItem.GetRootXamlObject C# (CSharp) Method

GetRootXamlObject() private method

Find's the Root XamlObject (real Root, or Root Object in Namescope)
private GetRootXamlObject ( XamlObject item, bool onlyFromSameNamescope = false ) : XamlObject
item ICSharpCode.WpfDesign.XamlDom.XamlObject
onlyFromSameNamescope bool
return ICSharpCode.WpfDesign.XamlDom.XamlObject
        private XamlObject GetRootXamlObject(XamlObject item, bool onlyFromSameNamescope = false)
        {
            var root = item;
            while (root.ParentObject != null)
            {
                if (onlyFromSameNamescope && NameScopeHelper.GetNameScopeFromObject(root) != NameScopeHelper.GetNameScopeFromObject(root.ParentObject))
                    break;
                root = root.ParentObject;
            }

            return root;
        }