DateTimePicker bug with Minimum value

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 9 years ago by Dave
Version: 10.1.0522
Platform: .NET 3.5
Environment: Windows 7 (32-bit)
Avatar
Hello,

Here are the steps to see the problem, the simple WPF code is below.

1) Create two DateTimePicker controls (start date, end date) and bind the "Minimum" property of the end date to the start date (so the end date cannot occur before the start date).

2) Run the app and set the start date DateTimePicker's value to 01/15/2010.

3) "Open" the end date DateTimePicker and begin scrolling back through the months using the left triangle on the upper bar - starting with today: May, April, March....

4) The problem occurs when the user gets to February; the top left triangle is disabled (grayed out), which does not allow the user to navigate to the month of January, even though there are 16 valid days that could be selected (16th - 31st).




WPF code:


<Window x:Class="DateTimePickersTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
Title="TestWindow" Height="150" Width="250"
Loaded="Window_Loaded" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<TextBlock Text="Start:" Grid.Column="0" Grid.Row="0"/>
<shared:DateTimePicker x:Name="StartDatePicker" Grid.Column="1" Grid.Row="0" Margin="2" IsEditable="True" Minimum="1900-01-01" YearSelectionEnabled="True" />

<TextBlock Text="End:" Grid.Column="0" Grid.Row="1"/>
<shared:DateTimePicker Grid.Column="1" Grid.Row="1" Margin="2" Value="{Binding EndDate}" IsEditable="True" Minimum="{Binding ElementName=StartDatePicker, Path=Value}" YearSelectionEnabled="True" />


</Grid>
</Window>

Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Dave,

Thanks for reporting this issue, which we've fixed for the next maintenance release. I'd also recommend you look at the DateTimeEditBox in our Editors for WPF product, as the DateTimePicker has been deprecated.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 13 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.