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
515
Date/Time rollover in XamDateTimeEditor
posted

Hello,

I'm wondering if there is an easy way to make the date/time "rollover"?

For example, in the editor above, if the user decremented the second, I have SpinWrap set to true so it decrements to 59, but the rest of the time stays the same (i.e. 14:00:59).  What I'd like to make it do is decrement the whole time, not just the second portion, so the new value would become 13:59:59.  Is there an easy way to do this, or would I have to handle an event and implement this functionality myself?

This is especially important for me with regards to crossing over midnight, since I don't want to show the date in this instance of the control, just the time, but I'd like the date to change if the value crosses over midnight (i.e. if 23:00:00 changes to 00:00:00, I'd like it to be 00:00:00 of the next day, not the same day).

Please let me know how to go about solving this.  Thank you!

  • 54937
    Verified Answer
    Offline posted

    You can try setting the SpinIncrement to "1s" (s=seconds, m=months or minutes depending on whether it has date sections or not, h=hours, d=days, y=years). By default the spin buttons spin just the section that has the caret but the SpinIncrement is used to spin the entire value.

  • 35319
    posted

    Hello,

     

    I have been looking into your issue and I can suggest you set the ‘SpinIncrement’ property of the XamDateTimeEditor to “1s” in order to achieve the desired functionality. I am sending you a sample application(XamDateTimeSpinInNonEditMode.zip) that meets your requirements.

     

    If you need any further assistance on this matter, feel free to ask.

    XamDateTimeSpinInNonEditMode.zip