How do you change the precision of the default xamNumericEditor in xamDataGrid?
As of now is only allows for a presision of of two, 0.00, but I need three 0.000
I have tried a couple of things, but none have worked.
Hello,
You should create a style for the XamNumericEditor and set its mask property. You can see how to create a mask here.
For example:
Mask = "nnn,nnn,nnn.nnn" as 'n' is a placeholder for a digit but not required; '#' like 'n' is a digit placeholder, but the digit is required.
You can also use this :{double:-i.f:c}
Please let me know if you have any questions on this.
Alex,
This example is in storage can you put out an updated link. Thank you ( Again )
Hi Alex,
Thanks for the mask link. However, for the column that I'm using the mask I'd like to keep the display value:
* limited to 2 decimal places if there are no decimals OR
* show only as many decimals as are actually present
Let me illustrate:
This is the mask i've specified: nnn,nnn,nnn.nnnn
* When i type in 2 in the column it expands to 2.000000, while I'd like it to display as 2.00
* If I enter 2.1234 it expands to 2.123400 , while I'd like it to display as 2.1234
So basically i want 6 decimals support but the display should be 2 decimals or the number of decimals in the number instead of all the 6 decimals.
Can you let me know how that could be achieved?
Thanks,
Joe
realized the mask I specified is incorrect. I'm using: nnnn,nnnn,nnn.nnnnnn
Thanks,Joe
jeez ! either i got twiddly fingers are the post editor is playing games !
here's the ACTUAL mask: nnn,nnn,nnn.nnnnnn
dont want to spam anymore so: 9 digits before and 6 digits after the decimal
Joe,
Yes, but the Mask property has effect only when the editor is in edit mode. It prompts you what is the format of the input that you have to make. The Format property has effect when the editor is not in edit mode and displays the data. The Format property requires standard format strings. So, what you are trying to achieve is this:
Format="###,###,###.######"
I have a requirement wherein I need to display the % sign as well as single digit after the decimal. Can you pls help me on this.
I got it working by providing the Format property this way -
percentStyle.Setters.Add(new Setter(XamNumericEditor.FormatProperty, "###############.0%"));
earlier I was setting the FormatProperty to "P" which was the problem.