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:
XAML:
<StackPanel Orientation="Vertical"> <telerikInput:RadDatePicker Value="{Binding ReminderDate, Mode=TwoWay}" /> <telerikInput:RadTimePicker Value="{Binding ReminderDate, Mode=TwoWay}" /></StackPanel>
C#:
public partial class TestPage : PhoneApplicationPage{ public Example examp = new Example(); public TestPage() { InitializeComponent(); this.DataContext = examp; } }public class Example{ public Example() { ReminderDate = new DateTime(); } public DateTime ReminderDate { get; set; }}
STEPS TO PRODUCE:
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,
-Nolan