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

Numeric datatypes

3 Answers 82 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Jason Parrish
Top achievements
Rank 1
Jason Parrish asked on 17 Nov 2011, 10:47 PM
I have noticed both in the demo and my own test code that if a property is any numeric type, the max value is 100.  How do I control this?

Also, I noticed that on the validating, the data types of the OldValue and NewValue are not the same, e.g.  OldValue is Integer but NewValue is Decimal.

3 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 21 Nov 2011, 04:43 PM
Hello Jason Parrish,

Thank you for writing.

You can edit the properties of the spin editor in the RadPropertyGrid EditorInitialized event. Here is a code snippet which demonstrates this:

private void radPropertyGrid1_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e)
{
  PropertyGridSpinEditor editor = e.Editor as PropertyGridSpinEditor;
 
  if (editor != null)
  {
    editor.MaxValue = 200;
  }
}

The reason for the NewValue and old value to be of different types is that the old value is the value of the property and the new value is taken form the editor. And since we have one editor for all numeric types there will be differences. 

I hope this explains things. Should you have further questions I would be happy to help. Greetings,
Ivan Petrov
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

0
Jason Parrish
Top achievements
Rank 1
answered on 21 Nov 2011, 04:50 PM
Thank you.  I already added similar code for that.  

However, I would like to suggest the control automatically defaults to the MinValue and MaxValue when the datatype is a value type.

0
Ivan Petrov
Telerik team
answered on 22 Nov 2011, 01:02 PM
Hi Jason Parrish,

Thank you for writing back.

This seems as a pretty reasonable idea. I have logged the idea into our Public Issue Tracking System - PITS. You can track the progress of this feature and vote it up on the following link - PITS Feature.

I have also updated your telerik points for the good suggestion.

All the best,
Ivan Petrov
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

Tags
PropertyGrid
Asked by
Jason Parrish
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Jason Parrish
Top achievements
Rank 1
Share this question
or