Values Being Rounded

3 posts, 1 answers
  1. Ryan
    Ryan avatar
    35 posts
    Member since:
    Jul 2015

    Posted 23 Feb Link to this post

    I might just be missing a very simple property here... the rows appear fine as soon as the application is run, but as soon as you click on a row, the value is rounded to two decimal places. Here's my code:

    private void RadForm1_Load(object sender, EventArgs e)
    {
        RadPropertyStore PropertyStore = new RadPropertyStore();
     
        radPropertyGrid1.SelectedObject = PropertyStore;
         
        PropertyStore.Add(new PropertyStoreItem(typeof(double), "test", 184.9484));
        PropertyStore.Add(new PropertyStoreItem(typeof(double), "test2", 341651.7823));
    }

    I tried to force the decimal places to remain the same using this, but it did not work:

    private void radPropertyGrid1_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e)
    {
        PropertyGridTableElement te = sender as PropertyGridTableElement;
        PropertyGridSpinEditor editor = e.Editor as PropertyGridSpinEditor;
     
        if (editor != null && te != null)
        {
            ((BaseSpinEditorElement)editor.EditorElement).DecimalPlaces = 5;
        }
    }

    How can I prevent my values from being rounded?

     

    Thanks!

  2. Answer
    Dess
    Admin
    Dess avatar
    1601 posts

    Posted 26 Feb Link to this post

    Hello Ryan,

    Thank you for writing.

    It is a known problem with RadPropertyGrid. Here is the feedback item for your reference: http://feedback.telerik.com/Project/154/Feedback/Details/120331-fix-radpropertygrid-propertygridspineditor-automatically-rounds-decimal-values

    Feel free to use the suggested workaround in the referred item.

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ryan
    Ryan avatar
    35 posts
    Member since:
    Jul 2015

    Posted 02 Mar in reply to Dess Link to this post

    Thank you, Dess!
Back to Top