I have a built a custom editor based on the Xam editors and I am having a small issue on the numeric masking. What we are trying to do is set a mask based on properties set in the editor xaml. We have it working for basic masks.
These are the settings we have:
Precision - Total length of fields. Scale - How many decimal places are needed. ShowCommas - Places commas (1,000,000). Allow Negative - places '-' at start of mask.
The mask is built in code. So if you set Precision=10, Scale = 4, ShowCommas = true and AllowNegatives = true the builder will return '-nnn,nnn.nnnn' as the mask. This is great, but we want to tweak it so that it will not always show trailing zeros, but only a set amount.
I want to introduce a new value, VisibleScale. This would tell the editor to trim off any excess zeros past the VisibleScale size. In the above case if I set VisibleScale = 2. I want the mask to only show the 2 zeros past the decimal point. So if the value is 100.1 the editor should display 100.10, but if its 100.001, then the editor should display 100.001. Is there anyway to do this?
The builder code looks something like this:
for (int i = 0; i < precision - scale; i++)
{
if (showCommas && (precision - scale - i) % 3 == 0 && i != 0)
maskStringBuilder.Append(',');
}
maskStringBuilder.Append('n');
if (scale > 0)
maskStringBuilder.Append('.');
for (int i = 0; i < scale; i++)
No I do not believe there are any mask section types/characters that provide that type of control. You may want to submit a feature request for this.