
I've been working with the MonthCalendar control with reasonable success even though it lacks good MVVM support. But I went to use the DateTimeEditBox and it seems the same stuff I've been using for the MonthCalendar control does not work. I'm attempting to Bind the StyleSelectors for DayItem, MonthItem, YearItem, and DecadeItem and my binding seems to be being ignored.
<UserControl ...>
<UserControl.Resources>
<Style x:Key="DateTimeEditBoxStyle" TargetType="{x:Type editors:DateTimeEditBox}">
<Style.Triggers>
<Trigger Property="DefaultDropDownContentType" Value="MonthCalendar">
<Setter Property="DropDownContentTemplate">
<Setter.Value>
<DataTemplate>
<editors:MonthCalendar BorderThickness="0"
SelectedDate="{Binding DateValue, RelativeSource={RelativeSource
AncestorType={x:Type editors:DateTimeEditBox}}}"
Style="{Binding MonthCalendarStyle, RelativeSource={RelativeSource
AncestorType={x:Type editors:DateTimeEditBox}}}"
FirstDayOfWeek="Sunday"
CalendarWeekRule="FirstDay"
DayOfWeekFormatPattern="Full"
cal:Message.Attach="[Event SelectionChanged] = [Action OnSelectDate]"
DayItemStyleSelector="{Binding DayStyleSelector}"
MonthItemStyleSelector="{Binding MonthStyleSelector}"
YearItemStyleSelector="{Binding YearStyleSelector}"
DecadeItemStyleSelector="{Binding DecadeStyleSelector}">
</editors:MonthCalendar>
</DataTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<editors:DateTimeEditBox DateValue="{Binding SelectedDate}"
Format="MM/dd/yyyy"
Style="{StaticResource DateTimeEditBoxStyle}"/>
</Grid>
</UserControl>
As you can see from the above code, the DayItemStyleSelector is bound a property in my ViewModel. The "get" never gets hit which tells me the binding is incorrect. I use a very similar chunk of code, but only the MonthCalendar part in another View/ViewModel and it works just fine. What am I missing?