Short question
Is there a quick way of knowing what a particular attached property is bound to, at runtime?
Detail
I'm debugging a UserControl (that inherits ItemsControl
) which binds Canvas.Left
and Canvas.Top
of its items to two properties of the ViewModel objects, through a style. At runtime, I place a breakpoint at a certain location and want to inspect the binding of Canvas.Left
attached property.
Note that I do not want to see the current value of the attached property for an item. I can easily do that by inspecting the value of Canvas.GetLeft(myItem)
in the QuickWatch or Immediate windows. I want to check the actual binding here, i.e. the VM property name to which this attached property is bound for myItem
.
I have tried Snoop already, which unfortunately doesn't show bindings of attached properties (if I didn't miss something obvious).
Output
window will show you any binding errors. No errors could mean what binding (if there is really any) was successful. Attached property has callback when value is changed, you can use that to debug attached property binding. – DollydolmanCanvas.Top="0"
you will get it, if you don't write, then it has default value obviously), you can override property, see here, then set callback and see what it was set for a given item (sender
will be theDependencyProperty
for which you set attached property value). – Dollydolman