Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
XamDateTimeInput Change Text
posted

hello

I'm using XamDateTimeInput.

this is my xaml

<Style TargetType="{x:Type ig:XamDateTimeInput}">
<Setter Property="Mask" Value="hh:mm tt"/>
</Style>

it result is : 12:32 PM.

but I want PM 12:32.

Im trying tt hh:mm. but it was not working...

how to use tt hh:mm?

Parents
  • 1700
    Verified Answer
    Offline posted

    Hello Kim,

    The Mask property supports specific characters and tokens that are documented here. Those are not the same characters that are used for the Format property which corresponds with the values available for formatting strings in .NET (both standard and custom). The Format Property is used to set a display pattern as the Mask Property is used for an Input pattern and can be used in combination

    Based on your description you could use a Mask of "hh:mm" (the absence of the am/pm token indicates 24 hour) and a Format of "tt hh:mm". The XamDateTimeInput would display this PM 12:32 out of edit mode, in edit mode would be displayed as 12:32 and the user would be able to enter 24 hour time. 

    Additionally, if you would like your user to enter 12 hour format the mask could be set like this “hh:mm tt”, however it might create inconsistency when the XamDateTimeInput is in and out of edit mode, so I recommend using the 24 hour format for the mask intead.

    Please test this approach and let me know if you have any questions.

    Regards
    Ivan Kitanov

Reply Children