An exception occurs when working with a font

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

    Posted 09 May 2018 Link to this post

    I use the font property when working with RadPropertyGrid.

    My user entered a font size of -1. An exception is thrown and the program falls.

    For comparison in the PropertyGrid (WinForms), this situation is correctly handled.

  2. Hristo
    Admin
    Hristo avatar
    1508 posts

    Posted 09 May 2018 Link to this post

    Hello Valery,

    I managed to reproduce the error and I have logged the issue on our feedback portal, here: FIX. RadPropertyGrid - unhandled exception in the control if you try to create a Font object with a negative size. I have also updated your Telerik points for the report. Additionally, you can subscribe to the item and be updated when its status changes.

    As a possible workaround, I can suggest handling the EditorInitialized of the control and set a minimum value to the spin editor: 
    private void RadPropertyGrid_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e)
    {
        PropertyGridSpinEditor editor = e.Editor as PropertyGridSpinEditor;
        if (editor != null && e.Item.Parent != null && e.Item.Parent.Name == "Font" && e.Item.Name == "Size")
        {
            editor.MinValue = 1;
        }
    }

    I hope this helps. Let me know if you need further assistance.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top