Timepicker - Click -> 15 min

2 posts, 0 answers
  1. Shaggy
    Shaggy avatar
    8 posts
    Member since:
    Jul 2013

    Posted 02 Dec 2013 Link to this post

    Hello,

    i need a solution, that the user only can make time inputs in 15 minute steps. For example:

    08:00
    08:15
    08:30
    ....

    Is there a opportuniy, special for the arrow keys, when he clicks on it and the minutes are chosen, that the tick is 15 minutes and not 1 minute?

    Greets,
    Shaggy
  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 05 Dec 2013 Link to this post

    Hello Zeljko,

    Thank you for contacting Telerik Support.

    You can restrict the user to make time inputs in 15 minute steps as follows:
    public Form1()
    {
        InitializeComponent();
     
        radTimePicker1.Step = 15;
        radTimePicker1.Value = new DateTime(1,1,1,radTimePicker1.Value.Value.Hour, 0 ,0);
        ((MaskDateTimeProvider)radTimePicker1.TimePickerElement.MaskedEditBox.Provider).MinutesStep = 15;
        radTimePicker1.TimePickerElement.MaskedEditBox.KeyPress += MaskedEditBox_KeyPress;
    }
     
    void MaskedEditBox_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (((MaskDateTimeProvider)radTimePicker1.TimePickerElement.MaskedEditBox.Provider).SelectedItemIndex == 2)
            e.Handled = char.IsLetterOrDigit(e.KeyChar);
    }

    The user is allowed to use the arrow keys for minutes navigation in 15 minutes interval. But the functionality to type in directly the minutes numbers is disabled due to the complexity of handling specific cases.

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top