Should property grid be able to support databinding?

Jun 30, 2011 at 2:06 AM

I'm using the current latest build (changeset 74372) in an MVVM application, and unless I'm doing something wrong, WPG is having problems with databinding.

The scenario is this: I have a TreeView which displays objects in a database (schema, tables etc). When I click on one, I want its properties to be displayed in the property grid. If I configure my code thusly:

<WPG:PropertyGrid Instance="{Binding SelectedItem, Mode=OneWay}" />

and put breakpoints into the PropertyGrid.Instance setter, OnInstanceChanged and CoerceInstance methods, then I can see the breakpoints being set when the view is first loaded, but after that, nothing happens when I click on an item in the TreeView. I've a TextBlock to the SelectedItem field so that I can verify that the selected item is correctly databound and changes when the selected TreeView item changes.

I've also tried completely breaking the MVVM pattern by directly referencing the PropertyGrid in my code and setting the Instance property directly, and that works, so the control itself is functional. It's just when I try to use binding after the initial view load that things go wrong.

Any thoughts?