Open xceedsoftware opened 7 years ago
itabaev[CodePlex]
Thank you very much!
I also change the file Xceed.Wpf.Toolkit/DateTimeUpDown/Implementation/DateTimeUpDown.cs in method InitializeDateTimeInfoList and add Length = elementLength in all DateTimeInfo declaration
BoucherS[CodePlex]
Hi,
For the selection in the calendar not being displayed in the MaskedTextBox, here's what I think is happening.
You use .(period) in the MaskedTextBox.Mask and your current Culture is, let's say, fr-CA. In that culture, .(periods) are converted as ,(comma). So at the end, the MaskedTextBox will use ,(comma). You use .(period) in your DateTimePicker.Format, so your Calendar SelectedValue contains .(periods). When it's time to validate this selection in the MaskedTextBox, the current culture is used by the MaskedTextBox. Since ,(comma) is not .(period), the validation of the selected value by the MaskedTextBox fails : No dates selected.
Make sure your DateTimePicker FormatString matches your current Culture since the inner MaskedTextBox will use the current Culture. For a Culture fr-CA, your DatetimePicker FormatString would use ,(comma), not .(period) : xctk:DateTimePicker FormatString=dd,MM,yyyy HH:mm:ss / Another options would be to modify the Culture of your Window : public MainWindow() { Thread.CurrentThread.CurrentCulture = new CultureInfo( en-US ); Thread.CurrentThread.CurrentUICulture = new CultureInfo( en-US ); InitializeComponent(); } and keep using .(period) in your MaskedTextBox and DateTimePicker : xctk:DateTimePicker FormatString=dd.MM.yyyy HH:mm:ss /
xctk:MaskedTextBox x:Name=PART_TextBox Mask=00.00.0000 00:00:00/
itabaev[CodePlex]
And selected date is not displayed in MaskedTextBox when I use a custom format dd.MM.yyyy HH:mm:ss (and mask 00.00.0000 00:00:00) and choose a date from the calendar.
itabaev[CodePlex]
Sample in gif
itabaev[CodePlex]
Thanks, the problem is partially corrected.
But there is a strange behavior when you start typing: after entering the first character selection moves to the next part of the date, after entering the second character of caret moves to the top line.
BoucherS[CodePlex]
Hi,
This will be fixed in v3.2. In the meantime, you can go in file Xceed.Wpf.Toolkit/Primitives/DateTimeUpDownBase.cs,
in method PerformMouseSelection(), and replace its content with ; var dateTimeInfo = this.GetDateTimeInfo( TextBox.SelectionStart ); if( (dateTimeInfo != null) (dateTimeInfo.Type == DateTimePart.Other) ) { this.Dispatcher.BeginInvoke( DispatcherPriority.Background, new Action( () = { // Select the next dateTime part this.Select( this.GetDateTimeInfo( dateTimeInfo.StartPosition + dateTimeInfo.Length ) ); } ) ); return; }
this.Select( dateTimeInfo );
itabaev[CodePlex]
I changed the DateTimePicker template using MaskedTextBox and it does not work properly. The position of the caret is changed when I try to enter a date. How can I fix this?