예제 #1
0
 internal static void PreserveFormatting(IDocumentRoot documentRoot, DocumentNode node)
 {
     if (node.SourceContext != null)
     {
         documentRoot.SetSourceContext(node, node.SourceContext.FreezeText(false));
     }
     if (node.ContainerSourceContext != null)
     {
         documentRoot.SetContainerSourceContext(node, node.ContainerSourceContext.FreezeText(false));
     }
     foreach (DocumentNode node1 in node.ChildNodes)
     {
         DocumentNodeHelper.PreserveFormatting(documentRoot, node1);
     }
 }
예제 #2
0
        private static void RefreshSiblingOrdering(DocumentNode node)
        {
            IDocumentRoot documentRoot = node.DocumentRoot;

            if (documentRoot == null || node.Parent == null)
            {
                return;
            }
            foreach (KeyValuePair <IProperty, DocumentNode> keyValuePair in (IEnumerable <KeyValuePair <IProperty, DocumentNode> >)node.Parent.Properties)
            {
                if (node != keyValuePair.Value)
                {
                    XamlSourceContext xamlSourceContext1 = keyValuePair.Value.ContainerSourceContext as XamlSourceContext;
                    if (xamlSourceContext1 != null)
                    {
                        XamlSourceContext xamlSourceContext2 = (XamlSourceContext)xamlSourceContext1.Clone(true);
                        xamlSourceContext2.RefreshOrdering();
                        documentRoot.SetContainerSourceContext(keyValuePair.Value, (INodeSourceContext)xamlSourceContext2);
                    }
                }
            }
        }