Browse Source

If the ParentProperty is a collection the collection itself is the TargetObject (for example when adding Bindings to the MultiBinding.Bindings property).

pull/53/merge
Tobias Gummesson 12 years ago committed by Siegfried Pammer
parent
commit
0c4f79df57
  1. 24
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObjectServiceProvider.cs

24
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObjectServiceProvider.cs

@ -56,14 +56,34 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -56,14 +56,34 @@ namespace ICSharpCode.WpfDesign.XamlDom
/// Gets the target object (the DependencyObject instance on which a property should be set)
/// </summary>
public object TargetObject {
get { return XamlObject.ParentProperty.ParentObject.Instance; }
get {
var parentProperty = XamlObject.ParentProperty;
if (parentProperty == null) {
return null;
}
if (parentProperty.IsCollection) {
return parentProperty.ValueOnInstance;
}
return parentProperty.ParentObject.Instance;
}
}
/// <summary>
/// Gets the target dependency property.
/// </summary>
public object TargetProperty {
get { return XamlObject.ParentProperty.DependencyProperty; }
get {
var parentProperty = XamlObject.ParentProperty;
if (parentProperty == null) {
return null;
}
return parentProperty.DependencyProperty;
}
}
#endregion

Loading…
Cancel
Save