Binding DatePicker and TimePicker to DateTime

2 posts, 1 answers
  1. Nolan
    Nolan avatar
    3 posts
    Member since:
    May 2013

    Posted 17 May 2013 Link to this post

    Is there a way to bind the DatePicker and the TimePicker to a single DateTime object so that the date of the DateTime object will be the date from the DatePicker, and the time from the DateTime object will be the selected time in the TimePicker? Currently, selecting a date from the DatePicker will make the DateTime object the selected date from the picker, and the current time. Then if you select the time from the TimePicker, it will change the DateTime object to the current date, and the selected time.

    Here is an example:

    <StackPanel Orientation="Vertical">
         <telerikInput:RadDatePicker Value="{Binding ReminderDate, Mode=TwoWay}" />
         <telerikInput:RadTimePicker Value="{Binding ReminderDate, Mode=TwoWay}" />


    public partial class TestPage : PhoneApplicationPage
         public Example examp = new Example();
         public TestPage()
              this.DataContext = examp;
    public class Example
         public Example()
              ReminderDate = new DateTime();
         public DateTime ReminderDate { get; set; }


    Assume that the current date is 5/1/2013 at 4:12 PM

    1. Select a date (say 5/20/2013). Now the ReminderDate = 5/20/2013 4:12PM
    2. Select a time (say 10:30PM). Now the ReminderDate = 5/1/2013 10:30PM

    How can I make it so when it does two-way binding, it gets: 5/20/2013 10:30PM, or do I have to do this through code?

    Thank you,

  2. Answer
    Deyan avatar
    2026 posts

    Posted 21 May 2013 Link to this post

    Hi Nolan,

    The code you've pasted here is correct. You will only need to implement the INotifyPropertyChanged interface on your business object and fire the PropertyChanged event each time the DateTime property is set with different value.

    This works on my side.

    I hope this helps.

    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
Back to Top