Hi,
I am using the XamCurrencyInput to bind to a decimal? value on my ViewModel. I am using the ValueToTextConverter and ValueToDisplayText converters to convert the decimal to string and vice-versa. I need to do this as I have the situation where certain numbers need to be displayed in the following format:
So the rules I use to create the mask are:
Therefore, I need to have a mask like the following:
nnn\-nn{char:1:+:}n
But this doesn't work. The 'nnn\-nn' part works ok, but no further than that.
I'm not sure whether the mask is not correct, or is incompatible with the Mask property on the control. Please note that I have some success if I insert a [SPACE] character before the {char:1:+:}, but this then leaves the display value with a SPACE in it which I do not want.
Below is my XAML usage. Please note that I have NOT set the DataMode or the DisplayMode to 'Raw'.
<ig:XamCurrencyInput x:Name="PriceBox" FontSize="16" Grid.Row="1" Margin="1,1,-1,2" Mask="{Binding Mask}" PromptChar="" SpinButtonDisplayMode="Always" SpinIncrement="{Binding SpinIncrement}" TrimFractionalZeros="False" Value="{Binding Value}" ValueToDisplayTextConverter="{StaticResource MyConverter}" ValueToTextConverter="{StaticResource MyConverter}" />
Can anyone please advise how I can get this mask to work or confirm that it is not possible? For now, I will have to use a RegEdit on the ValueConstraint but I'd prefer to get the Mask working.
Regards,
Slugman
I have discovered that if I swap the following:
to
nnn\-99{char:1:+:}n
Then the mask allows me to only enter a : or + after the 6th character, which is what I am looking for. However, I do not understand why a '9' immediately before the {char} works as opposed to using an 'n'.
Can someone please advise?
SM
PS:-
I find most Mask based questions with the Infragistics Editor controls point back to the following article:
http://help.infragistics.com/Help/NetAdvantage/WindowsPhone/2012.1/CLR4.0/html/xamInputs_Masks.html
However, the examples on this page are somewhat simplistic and do not offer many examples or detail of how mask combinations can be made (if indeed, they can at all).
Problems (and my questions) still remain unanswered.
I've discovered that my value isn't displayed correctly on some occasions. I may have a decimal that has a value of 101.3125 which needs to be rendered as "101-04+". Using the above mask, everything renders correctly. However, when I click into the control, only the "101-" is displayed and the 04+ disappears. I can re-add this value in and the box accepts it, but I do not understand why the 04+ is removed. I do NOT do this in my converters - I can see from the values they are generating in the Output window that they are correctly converting between decimal and my custom format.
Any suggestions please?