UpDown on Time/Duration

2 posts, 0 answers
  1. Philip Ashworth
    Philip Ashworth avatar
    41 posts
    Member since:
    Dec 2009

    Posted 25 Jan 2010 Link to this post

    Hi,

    I have a requirement to show a duration i.e. 00:01:00 and then use a up down button to increase the seconds/minutes or hours.

    I also want to allow the user to type in a duration i.e. 01:10:00 but have the format restricted so that they can't type chars.

    Will the NumericUpDown or an Editor do this?

    Thanks Phil.
  2. Bobi
    Admin
    Bobi avatar
    513 posts

    Posted 26 Jan 2010 Link to this post

    Hello Philip,

    RadNumericUpDown can handle only numbers, it is not suitable for your requirement. I suppose that RadMaskedTextBox would be more appropriate for your scenario.
    You can use something like the following:
    <StackPanel x:Name="LayoutRoot">
            <telerik:RadMaskedTextBox x:Name="text" MaskType="DateTime" Mask="T" />
            <Button Content="UP" Click="ButtonUP_Click"/>
            <Button Content="Down" Click="ButtonDOWN_Click"/>
        </StackPanel>
    private void ButtonUP_Click(object sender, RoutedEventArgs e)
            {
                this.text.CallSpin(true);
            }
     
            private void ButtonDOWN_Click(object sender, RoutedEventArgs e)
            {
                this.text.CallSpin(false);
            }

    I hope that this will help you.
    Please let us know if you have any other questions or need some more help.

    Regards,
    Boryana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
Back to Top