This is a migrated thread and some comments may be shown as answers.

NestedProperties changed to an ObservableCollection

1 Answer 47 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Ari
Top achievements
Rank 1
Ari asked on 15 Jul 2013, 07:01 PM
Hi...

I seem to be running into a lot of trouble due to this change.  It seems that most user interactions lead to a huge amount of refreshing.

We are using the property grid in "Unbound" mode, meaning that we have AutoGeneratePropertyDefinitions set to false.

What I've seen, since updating to the latest version, is that most interactions, even clicking the plus and minus signs to expand properties or collapse them (exposing or hiding their NestedProperties), leads to all of the DataTemplates we've provided to property definitions being re-applied.  In effect, every control in the property grid, is being recreated.  It's not just for properties in the same PropertyDefinitionCollection: every property at every depth is being recreated from the DataTemplate.

I've managed to avoid the issue with the plus/minus buttons by suspending notifications (by calling SuspendNotifications() for every NestedProperties in a property in the PropertyGrid).  If I do that, the plus and minus signs do only what they had done in the past: reveal the nested properties, or hide them.  But that is more of a hack than a solution, and doesn't completely work, as I also need to be able to add nested properties in some cases, and to alter the DataTemplate in use for some properties.  Again, with a bit more hacking around, I found a way to fix issues with that: if I use the PropertyGridField's OnApplyTemplate() then I can update only the DataTemplate for the item I've changed, rather than reloading every one in the property grid.  But again, this seems like a hack to me, and doesn't completely work: the indentation for items added to NestedProperties is not correct.  I can possibly find another hack to get around that, but...

I'm guessing that this is not the intended effect of using ObservableCollection.  I'm wondering if there's something I'm doing wrong that leads to every item getting recreated.  I am surprised by two issues here.  First, that altering the NestedProperties of one PropertyDefinition leads to items in another's NestedProperties to get recreated, and second that clicking the plus/minus signs leads to items being recreated at all (this should lead only to hiding or showing, and I have trouble blaming myself for this, since none of my code even executes when those buttons are clicked).

Thanks!

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 17 Jul 2013, 11:10 AM
Hi Ari,

Indeed, you are right. Currently, the content is updated once IsExpanded property of PropertyDefinition is updated. I will investigate the case and let you know once I have more information.
Thank you a lot for reporting the issue.  

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
PropertyGrid
Asked by
Ari
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or