DateTimeUpDown: Value reset after editing using the keyboard

Nov 13, 2011 at 11:09 AM


I have a DateTimeUpDown (Extended WPF Toolkit) and DatePicker (WPF Toolkit) both bound to the same dependency property (StartDate).

Sometimes when I edit the DateTimeUpDown text, using the keyboard, the value restarted to the last value, although the new text is matching the time format.

It mostly happen when I'm using the "Tab" key after typing the new text.

When I edit using the "Up" and "Down" buttons everything works fine.

Here's my code:

The controls:


<Custom:DatePicker x:Name="DatePicker_SetTime_From" FontFamily="Arial" FontSize="10.667" Margin="0,2,2,2" Height="21" Width="80" VerticalContentAlignment="Center" Style="{DynamicResource DatePickerStyle}"
                                SelectedDate="{Binding StartDate, ElementName=UserControl, Mode=TwoWay}"/>

<extToolkit:DateTimeUpDown x:Name="Spinner_DateTime_From" Height="21" Margin="2" Format="ShortTime"
                                        Value="{Binding StartDate, ElementName=UserControl, Mode=TwoWay}"/>


And the DateTimeUpDown style:


<Style x:Key="DateTimeUpDownStyle" TargetType="{x:Type extToolkit:DateTimeUpDown}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="HorizontalContentAlignment" Value="Right"/>
        <Setter Property="TextAlignment" Value="Right"/>
        <Setter Property="WatermarkTemplate">
                    <ContentControl Content="{Binding}" Foreground="Gray" Focusable="False"/>
        <Setter Property="Template">
                <ControlTemplate TargetType="{x:Type extToolkit:DateTimeUpDown}">
                    <extToolkit:ButtonSpinner x:Name="Spinner" AllowSpin="{TemplateBinding AllowSpin}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" IsTabStop="False" ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}" BorderBrush="{DynamicResource bc_odTextBoxStroke}" Style="{DynamicResource BC_ButtonSpinnerDatePicker}">
                        <extToolkit:WatermarkTextBox x:Name="TextBox" AcceptsReturn="False" BorderThickness="0" Background="{TemplateBinding Background}" ContextMenu="{TemplateBinding ContextMenu}" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" MinWidth="20" TextWrapping="NoWrap" Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}" TabIndex="{TemplateBinding TabIndex}" WatermarkTemplate="{TemplateBinding WatermarkTemplate}" Watermark="{TemplateBinding Watermark}" Margin="0" FontFamily="Calibri" TextAlignment="Right" FontSize="10.667">
                                <Binding Path="IsEditable" RelativeSource="{RelativeSource TemplatedParent}">


Nov 14, 2011 at 7:04 PM

I am guessing that your culture is not US.  There was a problem with the DateTimeParser with some cultures in v1.5.0.  Can you download the current source code and give it a try?

Nov 15, 2011 at 6:01 AM

Hi Brian,

I tried the current source code, both "Main" and "Development".

When I used the "Main", I wasn't able to edit using the up and down buttons.

When I used the "Development", I got exception while loading.



Nov 15, 2011 at 1:57 PM

You must be using the .NET 3.5 solution.  The 3.5 solution has not been updated with current changes yet. You should try out the 4.0 solution.  It has all the current fixes and features.

Nov 16, 2011 at 7:08 AM

I used the .Net 4 solution.

Nov 16, 2011 at 1:35 PM

You need to verify which solution you are using.  The up down buttons are broken in the 3.5 solution.  Everything works in the 4.0 solution under than main folder.  I cannot duplicate this issue.  Can you provide a sample application?