@ -267,6 +267,16 @@ namespace ICSharpCode.WpfDesign.XamlDom
oldPropertyElement . ParentNode . RemoveChild ( oldPropertyElement ) ;
oldPropertyElement . ParentNode . RemoveChild ( oldPropertyElement ) ;
}
}
}
}
XmlElement CreatePropertyElement ( )
{
string ns = parentObject . OwnerDocument . GetNamespaceFor ( parentObject . ElementType ) ;
return parentObject . OwnerDocument . XmlDocument . CreateElement (
parentObject . OwnerDocument . GetPrefixForNamespace ( ns ) ,
parentObject . ElementType . Name + "." + this . PropertyName ,
ns
) ;
}
internal void AddChildNodeToProperty ( XmlNode newChildNode )
internal void AddChildNodeToProperty ( XmlNode newChildNode )
{
{
@ -280,10 +290,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
parentObject . XmlElement . InsertBefore ( newChildNode , parentObject . XmlElement . FirstChild ) ;
parentObject . XmlElement . InsertBefore ( newChildNode , parentObject . XmlElement . FirstChild ) ;
return ;
return ;
}
}
_ propertyElement = parentObject . OwnerDocument . XmlDocument . CreateElement (
_ propertyElement = CreatePropertyElement ( ) ;
this . PropertyTargetType . Name + "." + this . PropertyName ,
parentObject . OwnerDocument . GetNamespaceFor ( this . PropertyTargetType )
) ;
parentObject . XmlElement . InsertBefore ( _ propertyElement , parentObject . XmlElement . FirstChild ) ;
parentObject . XmlElement . InsertBefore ( _ propertyElement , parentObject . XmlElement . FirstChild ) ;
}
}
_ propertyElement . AppendChild ( newChildNode ) ;
_ propertyElement . AppendChild ( newChildNode ) ;
@ -296,10 +303,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
if ( collection = = null ) {
if ( collection = = null ) {
if ( collectionElements . Count = = 0 & & this . PropertyName ! = this . ParentObject . ContentPropertyName ) {
if ( collectionElements . Count = = 0 & & this . PropertyName ! = this . ParentObject . ContentPropertyName ) {
// we have to create the collection element
// we have to create the collection element
_ propertyElement = parentObject . OwnerDocument . XmlDocument . CreateElement (
_ propertyElement = CreatePropertyElement ( ) ;
ParentObject . ElementType . Name + "." + this . PropertyName ,
parentObject . OwnerDocument . GetNamespaceFor ( ParentObject . ElementType )
) ;
if ( this . IsResources ) {
if ( this . IsResources ) {
parentObject . XmlElement . PrependChild ( _ propertyElement ) ;
parentObject . XmlElement . PrependChild ( _ propertyElement ) ;