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

An exception occurs when working with a font

1 Answer 107 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Valery
Top achievements
Rank 1
Veteran
Valery asked on 09 May 2018, 05:14 AM

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.

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 09 May 2018, 03:17 PM
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.
Tags
PropertyGrid
Asked by
Valery
Top achievements
Rank 1
Veteran
Answers by
Hristo
Telerik team
Share this question
or