@ -97,7 +97,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
XmlAttribute xmlAttribute ;
XmlAttribute xmlAttribute ;
internal XmlAttribute XmlAttribute {
internal XmlAttribute XmlAttribute {
get { return xmlAttribute ; }
get { return xmlAttribute ; }
set {
set {
xmlAttribute = value ;
xmlAttribute = value ;
@ -105,9 +105,26 @@ namespace ICSharpCode.WpfDesign.XamlDom
}
}
}
}
static XmlElement VirtualAttachTo ( XmlElement e , XmlElement target )
string GetPrefixOfNamespace ( string ns , XmlElement target )
{
{
var prefix = target . GetPrefixOfNamespace ( e . NamespaceURI ) ;
var prefix = target . GetPrefixOfNamespace ( ns ) ;
if ( ! string . IsNullOrEmpty ( prefix ) )
return prefix ;
var obj = this ;
while ( obj ! = null )
{
prefix = obj . XmlElement . GetPrefixOfNamespace ( ns ) ;
if ( ! string . IsNullOrEmpty ( prefix ) )
return prefix ;
obj = obj . ParentObject ;
}
return null ;
}
XmlElement VirtualAttachTo ( XmlElement e , XmlElement target )
{
var prefix = GetPrefixOfNamespace ( e . NamespaceURI , target ) ;
XmlElement newElement = e . OwnerDocument . CreateElement ( prefix , e . LocalName , e . NamespaceURI ) ;
XmlElement newElement = e . OwnerDocument . CreateElement ( prefix , e . LocalName , e . NamespaceURI ) ;
foreach ( XmlAttribute a in target . Attributes ) {
foreach ( XmlAttribute a in target . Attributes ) {
@ -153,7 +170,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
}
}
internal override void RemoveNodeFromParent ( )
internal override void RemoveNodeFromParent ( )
{
{
if ( XmlAttribute ! = null ) {
if ( XmlAttribute ! = null ) {
XmlAttribute . OwnerElement . RemoveAttribute ( XmlAttribute . Name ) ;
XmlAttribute . OwnerElement . RemoveAttribute ( XmlAttribute . Name ) ;
xmlAttribute = null ;
xmlAttribute = null ;
@ -162,7 +179,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
if ( ! UpdateXmlAttribute ( false , out holder ) ) {
if ( ! UpdateXmlAttribute ( false , out holder ) ) {
element . ParentNode . RemoveChild ( element ) ;
element . ParentNode . RemoveChild ( element ) ;
}
}
}
}
//TODO: PropertyValue still there
//TODO: PropertyValue still there
//UpdateMarkupExtensionChain();
//UpdateMarkupExtensionChain();
}
}
@ -174,7 +191,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
XamlObject holder ;
XamlObject holder ;
if ( ! UpdateXmlAttribute ( false , out holder ) ) {
if ( ! UpdateXmlAttribute ( false , out holder ) ) {
if ( holder ! = null & &
if ( holder ! = null & &
holder . XmlAttribute ! = null ) {
holder . XmlAttribute ! = null ) {
holder . XmlAttribute . OwnerElement . RemoveAttributeNode ( holder . XmlAttribute ) ;
holder . XmlAttribute . OwnerElement . RemoveAttributeNode ( holder . XmlAttribute ) ;
holder . xmlAttribute = null ;
holder . xmlAttribute = null ;
holder . ParentProperty . AddChildNodeToProperty ( holder . element ) ;
holder . ParentProperty . AddChildNodeToProperty ( holder . element ) ;
@ -201,7 +218,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
while ( obj ! = null & & obj . IsMarkupExtension & & obj . ParentProperty ! = null ) {
while ( obj ! = null & & obj . IsMarkupExtension & & obj . ParentProperty ! = null ) {
obj . ParentProperty . UpdateValueOnInstance ( ) ;
obj . ParentProperty . UpdateValueOnInstance ( ) ;
obj = obj . ParentObject ;
obj = obj . ParentObject ;
}
}
}
}
bool UpdateXmlAttribute ( bool force , out XamlObject holder )
bool UpdateXmlAttribute ( bool force , out XamlObject holder )
@ -280,7 +297,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
/// </summary>
/// </summary>
public string ContentPropertyName {
public string ContentPropertyName {
get {
get {
return contentPropertyName ;
return contentPropertyName ;
}
}
}
}
@ -293,7 +310,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
throw new ArgumentNullException ( "propertyName" ) ;
throw new ArgumentNullException ( "propertyName" ) ;
// if (propertyName == ContentPropertyName)
// if (propertyName == ContentPropertyName)
// return
// return
foreach ( XamlProperty p in properties ) {
foreach ( XamlProperty p in properties ) {
if ( ! p . IsAttached & & p . PropertyName = = propertyName )
if ( ! p . IsAttached & & p . PropertyName = = propertyName )
@ -379,7 +396,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
}
}
object ProvideValue ( )
object ProvideValue ( )
{
{
if ( wrapper ! = null ) {
if ( wrapper ! = null ) {
return wrapper . ProvideValue ( ) ;
return wrapper . ProvideValue ( ) ;
}
}