This project has moved and is read-only. For the latest updates, please go here.

DataTimeUpDown Custom Format not working

Apr 11, 2011 at 6:43 AM

Using the 1.4.0 release it seems that using a custom format in the DateTimeUpDown control causes a NullReferenceException to be thrown in WPFToolkit.Extended.dll. Specifically in DateTimeParser.cs line 63.

Code is analogous to:

<extToolkit:DateTimeUpDown Format="Custom" FormatString="ddd, dd MMM yyyy" Value="{Binding Path=DateProperty}" />

With DateProperty being a DateTime Property in the ViewModel which is set as the DataContext. Other FormatString values result in identical behavior. RFC1123 or any other inbuilt formats operate as expected.

This wasn't occurring with an older CL (711112). Going back through the code base it looks like this issue first manifests in CL 71246.

Is it that the interface has changed and I'm using it incorrectly, or is it a bug?

 

On a similar note; I see that DateTimeUpDown has changed how it handles left and right key presses. It used to move between the DateTime components (day, month, year etc) and highlight them, allowing for the up/down keys to change the values. With the addition of the keyboard input I see this is no longer the case. Instead an editing cursor appears and the up/down key presses no longer work until a new component of the DateTime is selected via a double click. Is it possible to have a flag such that the old functionality could be enabled/disabled? Better yet, if they could be integrated such that the left/right/up/down keys work as before but typing over these values is also possible?

 

Thanks

<extToolkit:DateTimeUpDown Format="Custom" FormatString="ddd, dd MMM yyyy" Value="{Binding Path=Date}" />
Apr 11, 2011 at 4:50 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Apr 11, 2011 at 5:01 PM

I identified the problem and corrected it.  I will replace the current download with a patched version when I get to the hotel at MIX11 later today or you can download the source. 

As for your other concern, I did remove the behavior of the left/right arrow keys highlighting the next block.  This is because I made the date/time editable.  Having both modes caused unpreditable behavior.  I would try to guess when the user was trying to select the next block, or use the keyboard to move cursor to a specific location.  I haven't found a solution that provides both behaviors reliably.  So for now I had to remove it so the DateTime could be edited.  I felt the trade-off was worth it.

Apr 11, 2011 at 5:13 PM

Actually I just replaced the current download with the patched verion 1.4.0.1.  It's amazing what you can do from a laptop and free wifi in an airport.

Apr 12, 2011 at 2:09 AM

Excellent. Thanks Brian.