String properties are not being set when RadPropertyGrid.Item changes

4 posts, 1 answers
  1. Dave
    Dave avatar
    29 posts
    Member since:
    Aug 2010

    Posted 11 Aug 2011 Link to this post

    I just swapped out the http://slg40.codeplex.com/ property grid with your radPropertyGrid. The property grid is AutoGenerating the properties of the selected item from a radTreeView.

     I'm liking it thus far except for an issue when editing string properties and changing the item the property grid is set to. For example:

    I edit the string property Name from "Fred" to "Bob" in the property grid on item Alpha.
    I then select a different item, then switch back to Alpha.
    The change to Alpha is lost, displaying "Fred" again instead of "Bob".

    However, if i change the Name like before, then lose Focus on the property (select a different Property in the property grid or press Enter or Tab) the property will be saved.

    Is this intentional behavior? Can I force the property grid to set the string with each character change instead of on a lost focus event?
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 17 Aug 2011 Link to this post

    Hello Dave,

    I have prepared a small sample for you. It illustrates a possible approach to achieve updating the source on each keystroke.
    You can test it by running the app, placing a breakpoint in the setter of the FirstName property. It should be hit on each keystroke when changing the FirstName in the RadPropertyGrid.

    Hope that helps.
    Regards,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft banner
  4. Dave
    Dave avatar
    29 posts
    Member since:
    Aug 2010

    Posted 31 Aug 2011 Link to this post

    This works, however...

    Is there any other way to accomplish this in a more dynamic way? In my case, I don't want to have to set up dozens of data templates in XAML for each of the types of properties all of my different items could have, on top of having to maintain this list of data templates for any new property types.

    Thanks!
  5. Answer
    Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 03 Sep 2011 Link to this post

    Hello Dave,

    A more generic solution would be to create the template in code   - based on the template given , and only changing the name of the bound property - e.g. using XAMLReader.Load .

    Kind regards,
    Pavel Pavlov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top