formatting only in view mode

7 posts, 0 answers
  1. Hitesh
    Hitesh avatar
    16 posts
    Member since:
    Jul 2012

    Posted 27 Oct 2012 Link to this post

    number formatting like 23,344.45 should be displayed only in view mode. but when user enter it should display 23444.45 without formatting.
    Below text property is not displaying data in N2 string format. what is correct way to use Value and Text property.?

     <RadMaskedNumericInput
     Value="{Binding  XXX, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" 
    Mask="" Text={Binding StringFormat=N2}"/>
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 31 Oct 2012 Link to this post

    Hello Hitesh,

    You can take advantage of the ValueToTextConverter described in more details in our documentation. Basically it allows you to format the Text value based on the MaskedNumericInput.Value property. I attached a sample solution demonstrating how to use it to implement your requirement. Please have a look at it and let me know if it helps.

    Regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Hitesh
    Hitesh avatar
    16 posts
    Member since:
    Jul 2012

    Posted 31 Oct 2012 Link to this post

    Hi Tina,

    Thanks for sample app. but i need reverse way. In view mode it should display formatting.

    how i can apply convert on value to remove NumberGroupSeparator?

     

  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 05 Nov 2012 Link to this post

    Hi Hitesh,

    Please accept my apology for misunderstanding your scenario. The approach to implement your requirement is the same, however you need to remove the FormatString and change the ValueToTextConverter implementation.

    I modified my solution to demonstrate the changes I have in mind. Please let me know if it helps.

    Regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Hitesh
    Hitesh avatar
    16 posts
    Member since:
    Jul 2012

    Posted 06 Nov 2012 Link to this post

    Tina,

    Thanks for resolution. it is working but if value is only numbers like DoubleValue = 23344 then in edit mode it is not allowing to enter decimal value. it is considering as only numeric value since string format is not applied during edit mode.
  7. Hitesh
    Hitesh avatar
    16 posts
    Member since:
    Jul 2012

    Posted 06 Nov 2012 Link to this post

    with FormatString="0"  or "0.00" is working fine in view mode.
  8. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 09 Nov 2012 Link to this post

    Hello Hitesh,

    I'm glad you found a solution. Let us know if you have more questions.

    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready