Browse Source

Added update of child markup extensions when markup extension chain is updated.

pull/617/head
gumme 11 years ago
parent
commit
13002cf065
  1. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs
  2. 15
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs

6
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs

@ -627,6 +627,12 @@ namespace ICSharpCode.WpfDesign.Tests.Designer @@ -627,6 +627,12 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
bindingItem.Properties["Source"].Value.Properties["ResourceKey"].SetValue("bindingSource");
}
var binding = bindingItem.Component as Binding;
Assert.IsNotNull(binding);
Assert.IsNotNull(binding.Source);
Assert.IsNotNull(exampleClassItem.Component);
Assert.AreSame(exampleClassItem.Component, binding.Source);
const string expectedXaml = "<Button>\n" +
" <Button.Resources>\n" +
" <t:ExampleClass x:Key=\"dummy\" />\n" +

15
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs

@ -272,10 +272,23 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -272,10 +272,23 @@ namespace ICSharpCode.WpfDesign.XamlDom
NameChanged(this, EventArgs.Empty);
}
}
void UpdateChildMarkupExtensions(XamlObject obj)
{
foreach (XamlObject propXamlObject in obj.Properties.Where((prop) => prop.IsSet).Select((prop) => prop.PropertyValue).OfType<XamlObject>()) {
UpdateChildMarkupExtensions(propXamlObject);
}
if (obj.IsMarkupExtension && obj.ParentProperty != null) {
obj.ParentProperty.UpdateValueOnInstance();
}
}
void UpdateMarkupExtensionChain()
{
var obj = this;
UpdateChildMarkupExtensions(this);
var obj = this.ParentObject;
while (obj != null && obj.IsMarkupExtension && obj.ParentProperty != null) {
obj.ParentProperty.UpdateValueOnInstance();
obj = obj.ParentObject;

Loading…
Cancel
Save