I’m building an application that needs to display and accept dates from my model ( which is retrieved from a database). The model exposes a property called EntryTime:
private DateTime entryTime;
[Column]
public DateTime EntryTime
{
get { return entryTime; }
set
{
if (entryTime != value)
{
this.NotifyPropertyChanging("EntryTime");
entryTime = value;
this.NotifyPropertyChanged("EntryTime");
}
}
}
I have both a DatePicker and a TimePicker on my page and want to bind them both to the EntryTime. I tried binding them just by binding the values but that didn’t work:
<toolkit:DatePicker HorizontalAlignment="Left" Margin="151,6,0,0" x:Name="dateCurrent" VerticalAlignment="Top" Width="175" Value="{Binding CurrentEntry.EntryDate}" />
<toolkit:TimePicker HorizontalAlignment="Left" Margin="313,6,0,0" Name="timeCurrent" VerticalAlignment="Top" Value="{Binding CurrentEntry.EntryDate}" Width="137" />
I’m relatively new to Silverlight so i’m not sure what i can do to just bind the time picker to the time for EntryDate and the DatePicker to the date for EntryDate.
Thank you for your help
The binding should work. If you can elaborate on exactly what issue you’re having that would be great. The one thing I did notice that you were missing was the “TwoWay” Mode on your binding: