Want some good news or bad news?
The good news is that Microsoft claims that this problem was fixed in the February 2010 release of WPFToolkit. And it was.
The bad news is that while setting the DatePicker IsEnabled to True will allow you to use DatePicker, you can now click the Calendar button to select a date, it will still be disabled.
"Mistake"? Did I say the word "mistake"?
Of course not.
You can get around this by applying <Style> though.
Below is a simple xaml code for demonstration.
It displays two rows, each of which contains CheckBox and DatePicker. When you click on a CheckBox in a line, it should include a DatePicker in that line.
This shows the difference between a DatePicker with no style (in the first line) and a DatePicker with style (in the second line).

Both DatePickers are correctly enabled / disabled, but in the first line it never looks like it is. DatePicker in the second line uses Style to show the user when he is disconnected.
Notice how this code sets the background of both the DatePicker control and the DatePickerTextBox part.
<Window x:Class="WPFDatePickerTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wpf="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit" xmlns:primitives="clr-namespace:Microsoft.Windows.Controls.Primitives;assembly=WPFToolkit" Title="Window1" Height="317" Width="461"> <Window.Resources> <Style TargetType="{x:Type primitives:DatePickerTextBox}"> <Style.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Background" Value="Transparent"/> </Trigger> </Style.Triggers> </Style> <Style x:Key="DatePickerStyle1" TargetType="{x:Type wpf:DatePicker}"> <Style.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Background" Value="{x:Static SystemColors.InactiveBorderBrush}"/> </Trigger> </Style.Triggers> </Style> </Window.Resources> <Grid> <StackPanel> <WrapPanel> <CheckBox Height="16" Name="cbDateOfJoining" Width="120">Date of joining</CheckBox> <wpf:DatePicker Height="25" Name="datePicker1" Width="140" IsEnabled="{Binding IsChecked, ElementName=cbDateOfJoining}" /> </WrapPanel> <WrapPanel> <CheckBox Height="16" Name="cbDateOfLeaving" Width="120">Date of leaving</CheckBox> <wpf:DatePicker Height="25" Name="datePicker2" Width="140" IsEnabled="{Binding IsChecked, ElementName=cbDateOfLeaving}" Style="{DynamicResource DatePickerStyle1}" /> </WrapPanel> </StackPanel> </Grid> </Window>
Hope that helps!
And I hope that it is fixed correctly in the next version of WPFtoolkit. Users have been complaining about this issue since 2009 ...
Mike gledhill
source share