Strange behavior (PropertyGridSpinEditor)

2 posts, 0 answers
  1. Valery
    Valery avatar
    53 posts
    Member since:
    May 2011

    Posted 30 Oct 2018 Link to this post

    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.

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3219 posts

    Posted 31 Oct 2018 Link to this post

    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.
Back to Top