Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Commented Unassigned: DateTime picker crashes with foreign cultures/custom TimeFormat [21479]

$
0
0
The date time picker control crashes when using foreign culture settings in windows e.g. German, Finnish.

These cultures use date stamps like 22.10.2014 1:05:07, 100

Iff you dont provide a custom FormatString the control will display, but wont allow interaction and will throw an uncaught exception if you attempt to open the calendar.

Additionally iff you stipulate a FormatString in XAML the app will crash with an XAML exception.

I tracked this bug in V 2.3 to the following:

DateTimeUpDown.cs line 559 - DateTime date = DateTime.Parse(Value.ToString());

I am not sure why this is there, Value is already a DateTime? so you can easily check if its null and if not extract the date time directly without using parse (an absolute nightmare function btw). Also upstream the Value is checked for null so worrying about null SHOULDN'T be an issue, although this would choke on null anyways.

My fix was: DateTime date = Value.Value;

Would still break on null, but SHOULD be safe to assume thats not an issue.

Maybe I am just having weird issues, but seems to be a bug to me.

Hope this helps :D
Comments: ** Comment from web user: BoucherS **

Hi Dysl3xik,

I understand what you say, but I cannot reproduce the issue with german language :

```
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture( "de-DE" );
```

I don't have a crash with DateTimePicker (with or without FormatString)
```
<xctk:DateTimePicker Format="Custom" FormatString="dd.MM.yyyy HH:mm:ss"/>
```
Can you provide a snippet to have the exact same as yours ?
Thanks.


Viewing all articles
Browse latest Browse all 4964

Trending Articles