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

Hide and set default values, confused?

5 Answers 128 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 2
Martin asked on 25 Mar 2013, 10:42 AM
I would like to hide default values for CLR types without making them nullable.

I have properties like Top, Left and the default value for int is 0, but I don't want to show zero, just values set by the user or by me in code.

5 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 28 Mar 2013, 01:06 PM
Hi,

Based on the previous communications with you , I guess that you are using the PropertySets feature. May, I ask you whether am I right? Basically, RadPropertyGrid relies exclusively on bindings and they will automatically retrieve a property's value, which is the default one if it is not initialized with a new value, so such a customization won't be easy to implement. May, I ask you for some more extensive information on your scenario, so that we could think in its context.

All the best,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Martin
Top achievements
Rank 2
answered on 28 Mar 2013, 01:16 PM
I just think that default values are the same a not providing any values.

It's would just be nice to have a flag "HideDefaultClrValues" on the property grid.
0
Ivan Ivanov
Telerik team
answered on 28 Mar 2013, 01:45 PM
Hello,

 Unfortunately, supporting such a feature natively won't be compatible with our current architecture. However, I have thought of an easy modification. You can subscribe to RadPropertyGrid's FieldLoaded event and rebind the respective editors by setting OneWayToSource binding mode. Can you please confirm, whether this approach works for you?

Regards,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Martin
Top achievements
Rank 2
answered on 28 Mar 2013, 06:50 PM
Will it still be possible to update the field? if so I will give it a try
0
Ivan Ivanov
Telerik team
answered on 29 Mar 2013, 12:09 AM
Hello,

 Well, OneWayToSource binding will propagate changes only from the View (UI) to the ViewModel and not the other way around. I guess that this is what you really need to achieve your requirements?

Greetings,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
PropertyGrid
Asked by
Martin
Top achievements
Rank 2
Answers by
Ivan Ivanov
Telerik team
Martin
Top achievements
Rank 2
Share this question
or