NestedProperties changed to an ObservableCollection

2 posts, 0 answers
  1. Ari
    Ari avatar
    14 posts
    Member since:
    Jul 2012

    Posted 15 Jul 2013 Link to this post


    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).

  2. Maya
    Maya avatar
    4062 posts

    Posted 17 Jul 2013 Link to this post

    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.  

    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 >>
Back to Top