WPF DatePicker IsEnabled property not changing appearance
Posted
by Jonathan
on Stack Overflow
See other posts from Stack Overflow
or by Jonathan
Published on 2010-04-14T06:47:45Z
Indexed on
2010/04/14
6:53 UTC
Read the original article
Hit count: 757
I think I have found an issue with the DatePicker in the toolkit, perhaps some of you gurus can check it out.
The issue is when setting the IsEnabled property of the DatePicker. If set in XAML, it stays grey even if you set the IsEnabled to true at run time. The same goes for the other way around should it start off being enabled.
The button just changes the IsEnabled property of the date picker, you will see that when it becomes enabled, the style remains grayed out.
<Window x:Class="WpfApplication3.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tk="http://schemas.microsoft.com/wpf/2008/toolkit"
Title="Window1" Height="300" Width="300">
<StackPanel>
<tk:DatePicker x:Name="txtDate" IsEnabled="False"></tk:DatePicker>
<Button Height="25" Click="Button_Click"></Button>
</StackPanel>
</Window>
private void Button_Click(object sender, RoutedEventArgs e)
{
txtDate.IsEnabled = !txtDate.IsEnabled;
}
© Stack Overflow or respective owner