Hi
I would like to use a XamEditorMask as Editor for a timespan. I used the following code:
<igEditors:XamMaskedEditor ValueType="sys:TimeSpan"
Value="{Binding …}"
Mask="hh:mm:ss"
InvalidValueBehavior="RevertValue">
<igEditors:XamMaskedEditor.ValueConstraint>
<igEditors:ValueConstraint ValidateAsType="TimeSpan"
Nullable="False"/>
</igEditors:XamMaskedEditor.ValueConstraint>
</igEditors:XamMaskedEditor >
The problem is now, that I should be able to fill out more than 24h, but the editor doesn’t accept more than this 23:59:59.
What can I do? How is the Input validated exactly?
Best regards
Currently the ValueToTextConverter is not used when applying the value to the mask - only the TypeConverter is which in this case is the TimeSpan's TypeConverter. Since the typeconverter conditionally includes the day section that results in the resulting string not mapping correctly to the mask. We can look into considering the ValueToTextConverter when applying the mask. In the meantime likely you would need to leave the ValueType set to string and use your converter on the binding you're doing on the Value property (i.e. converting to/from the string provided by the Value property and your underlying TimeSpan property).
Hi AndrewThanks for your answer. Your proposal works partly.
The input format ist ok. I can fill out the editor with the desired input format. Further I had to write a ValueConverter, to deal with TimeSpans that are longer than 24h to format the TimeSpan in the correct way. (I set the value converter on ValueToTextConverter and ValueToDisplayConverter)
But now I have the problem, that when the TimeSpan ist bigger as 24h and I click in the editor to edit the value, the display format ist wrong. I could see in the debug mode, that the ValueConverter isn't involved in this action. Can I manipulate this value also?
'hh:mm:ss' is a time mask as would be part of a DateTime. The valid hours for time can only be 0-23. If you want to simulate a TimeSpan then you might use a mask like "nn:nn:nn" or "{number:0-99}:{number:0-59}:{number:0-59}" instead.