So, I wrote this code some time ago, and it worked fine, but recently, for some reason, now it doesn't work at all. Here xaml ...
<DatePicker SelectedDate="{Binding Criteria}" IsEnabled="{Binding IsEnabled}" Width="130" HorizontalAlignment="Right">
<DatePicker.CommandBindings>
<CommandBinding Command="controls:DateCommands.SelectToday" CanExecute="CommandBinding_CanExecute" Executed="CommandBinding_Executed"/>
</DatePicker.CommandBindings>
<DatePicker.CalendarStyle>
<Style TargetType="{x:Type Calendar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Calendar}">
<TabControl>
<TabItem Header="Calender">
<CalendarItem Background="{TemplateBinding Control.Background}" BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="{TemplateBinding Control.BorderThickness}" Style="{TemplateBinding Calendar.CalendarItemStyle}" />
</TabItem>
<TabItem Header="Relative Time">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Command="controls:DateCommands.SelectToday" CommandParameter="Today" Content="Today" />
<Button Grid.Column="1" Command="controls:DateCommands.SelectToday" CommandParameter="Yesterday" Content="Yesterday" />
</Grid>
</TabItem>
</TabControl>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DatePicker.CalendarStyle>
</DatePicker>
Basically, I redefine the date picker calendar and place a tab control that allows the user to select the relative time macro rather than the actual time (as a result of which the generated query always uses this relative time). This works well, but now when I try to select from the calendar, nothing happens and no values are ever populated in the field or in the backup property.
I took out the code and dumped it into a new project to experiment and could not get this simple case to even work ...
<DatePicker Width="130" HorizontalAlignment="Right">
<DatePicker.CalendarStyle>
<Style TargetType="{x:Type Calendar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Calendar}">
<CalendarItem Background="{TemplateBinding Control.Background}" BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="{TemplateBinding Control.BorderThickness}" Style="{TemplateBinding Calendar.CalendarItemStyle}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DatePicker.CalendarStyle>
</DatePicker>
, , . , , , , - , , , , , ?