Silverlight 4 Calendar Binding to SelectedDate not updating
Morning folks,
I'm using Silverlight 4 and using the Calendar object's SelectedDate to try to populate the Text element of a Textblock, but changing the selection of the calendar isn't updating the binding:
<TextBlock x:Name="currentWeekLabel" Text="{Binding SelectedDate, ElementName=ByWeekCalendar, Converter={StaticResource WeekChosenConverter}, Mode=OneWay}"
VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" Foreground="White" Padding="10 0 0 0" FontWeight="Black" />
I get no binding errors but do I need to implement I开发者_如何学运维NotifyPropertyChanged on the SelectedDate property or something, I can't understand why the Converter is never being entered.
Thanks, Becky
You won't need to implement INotifyPropertyChanged
because you aren't binding to a property defined in your code. The SelectedDate
property of the Calendar control is a DependencyProperty
so it should update fine.
Try removing the converter from the binding, if it starts working your problem is in your converter. If not then show us the Xaml for the Calendar.
精彩评论