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

String properties are not being set when RadPropertyGrid.Item changes

3 Answers 167 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 11 Aug 2011, 07:01 PM
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?

3 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 17 Aug 2011, 03:07 PM
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 >>

0
Dave
Top achievements
Rank 1
answered on 01 Sep 2011, 12:05 AM
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!
0
Accepted
Pavel Pavlov
Telerik team
answered on 03 Sep 2011, 01:10 PM
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 >>

Tags
PropertyGrid
Asked by
Dave
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Dave
Top achievements
Rank 1
Share this question
or