Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
Rounding off
posted

Hi,

I am doing masking in XamnNmericEditor. For masking i am using mask = "nnnnn.nn" i.e. number should contain upto two decimal places.

I am facing one problem regarding that. Actually if number is coming as "12.1287", it is displaying it as "12.13" i.e. its is rounding of the value. 

We want to avoid rounding off i.e. if value is "12.1287" we want to show it as "12.12".

Please tell how to achieve this.

Thanks,

Prasoon

Parents
No Data
Reply
  • 16495
    Verified Answer
    Offline posted

     Hello  Prasoon,

     

    Thank you for your post.

     

    I have been looking into your requirement and if I understand what you are trying to achieve correctly I can  suggest you to  use converter in the binding for the Value of XamNumericEditor. You can write your own function and use in it Floor and Pow methods of Math class with  a variable length as well in order to return the number you wish. You can use this function in the  converter. I created short sample application based on your scenario in order to show you how you can implement this approach and achieve the functionality you are looking for. Please let me know if I am missing something from your scenario.

     

    If you require any further assistance on the matter, please do not hesitate to let me know.

    RoundingOff.zip
Children