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

Strange behavior (PropertyGridSpinEditor)

1 Answer 62 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Valery
Top achievements
Rank 1
Veteran
Valery asked on 30 Oct 2018, 12:47 PM

if you completely delete the contents in the editor and press the <Enter> key, then int.MinValue is returned.

Why? In this case, you must return either null or 0 or do nothing.

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 31 Oct 2018, 11:01 AM
Hello, Valery, 

Since R1 2017 RadSpinEditor supports null values. In order to enable this functionality for the PropertyGridSpinEditor, it is necessary to set the EnableNullValueInput property to true when the editor is initialized. You can find below a sample code snippet:  
private void radPropertyGrid1_EditorInitialized(object sender, Telerik.WinControls.UI.PropertyGridItemEditorInitializedEventArgs e)
{
    PropertyGridSpinEditor editor = e.Editor as PropertyGridSpinEditor;
    if (editor != null)
    {
        BaseSpinEditorElement el = editor.EditorElement as BaseSpinEditorElement;
        el.EnableNullValueInput = true;
    }
}

When the editor is activated, pressing Ctrl+Del will clear the value. Note that the associated property should allow null values in order to clear the value. Otherwise, 0 will be set as a new value instead of null.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PropertyGrid
Asked by
Valery
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or