Search code examples
silverlightmvvmdatepickerwcf-ria-servicestimepicker

Datepicker updates Timepicker


I have a form with a datepicker and a timepicker which both are bound to the same property from the model

here my simple Model:

private DateTime _end;
[Required]
public DateTime End
{
    get
    {
        return _end;
    }
    set
    {
        _end = value;
        RaisePropertyChanged(() => End);
    }
}

the viewmodel has a property of the ModelObject.

My XAML looks like this

<sdk:DatePicker SelectedDate="{Binding Path=CurrentAppointment.End, Mode=TwoWay}"/>
<toolkit:TimePicker Value="{Binding Path=CurrentAppointment.End, Mode=TwoWay}" />

is there a simple way to precent the time from changing when i pick the date (it always goes back to 00:00 because the datepicker sets the date to 2011-04-29 00:00:00) or do i have to make a property for the time in my model and put the date and the time together when i want to put it in my database?


Solution

  • This question is exactly the same as

    Using silverlight datepicker and timepicker together

    Use Converter