Feature Requests: DateTimePicker/Calendar

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 11 years ago by Phil Devaney - Senior Software Engineer, Serck Controls Ltd
Version: 4.5.0470
Avatar
I have a number of feature requests for the DateTimePicker/Calendar controls, as well as a minor bug. In rough order of importance:

1. I would like a version of the controls that use the new DateTimeOffset type introduced in 3.5. I don't care if the control allows editing of the Offset part, as long as it is preserved when editing the date/time.
2. Improve the manual editing of DateTimePicker to be more like the standard Win32/WinForms control i.e. masked editing, automatic rejection of invalid input, use of arrow keys. I guess some of this might already be planned with the masked editors that are in development.
3. Mimic the 'zoom out' functionality in the standard Calendar control under Vista, where clicking on the month in header zooms out to the year, then the decade then century. Also, it would be nice if the default visual style more closely matched the standard control under Vista.
4. I found an unhandled ArgumentOutOfRangeException is thrown from System.DateTime.AddMonths if the year of Calendar.SelectedDate is set to 0001 or 9999. I have no real need to use these values, I was just experimenting and found the problem.
5. To go with the WeekNumbersVisible property, a FirstWeekOfYear property might be useful, similar to Outlook e.g. whether first week is 1st Jan or 1st full week.

Phil

Comments (6)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Phil,

Thanks for the post, we'll keep your great ideas on hand as we enhance our existing calendar controls and work on the Editors product.


Actipro Software Support

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Fyi, with the exception of #1, these issues have been addressed by the DateTimeEditBox and MonthCalendar controls in our Editors for WPF product.


Actipro Software Support

Posted 10 years ago by Phil Devaney - Senior Software Engineer, Serck Controls Ltd
Avatar
Thanks, I have been using these controls for some time now. Are there any plans for a DateTimeOffsetEditor? I have managed to make my own that uses DateTimePartGroup, but there are some bits I couldn't get right like working out the correct value for DefaultDropDownContentType
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Phil,

We have a TODO item marked down for the DateTimeOffsetEditBox. Unfortunately, we currently target .Net 3.0, but DateTimeOffset is only available in .Net 3.0/3.5 SP1 and up. So it will have to wait until we up our system requirements, and I'm not sure when that would happen.

The DefaultDropDownContentType is just used by the DateTimeEditBox to dynamically switch the drop-down content based on the current Format. That's not something you can really set, so I'm not sure exactly what you are asking.


Actipro Software Support

Posted 10 years ago by Phil Devaney - Senior Software Engineer, Serck Controls Ltd
Avatar
Thanks for the info, I had forgotten you aren't targetting 3.5 yet.

What I have implemented is a new class DateTimeOffsetEditBox derived from RangeTypeSpecificEditBoxBase<DateTimeOffset?>, which 'borrows' most of the dependency properties on DateTimeEditBox with AddOwner. I added some DateTime properties to mirror the DateTimeOffset properties defined by the base class (e.g. Value, Minimum) which are updated in PropertyChanged handlers. Then in GenerateDefaultItems I create a DateTimePartGroup and bind its Value property to my ValueDT property.
This all works fine, however I couldn't 'borrow' DefaultDropDownContentType for my class because the CoerceValue callback checks for a DateTimeEditBox, so I just fixed the DropDownCOntent as a DateTimeEditor in my Style. I could try and implement my own logic for the property, but I didn't want to spend too much time on it if you were planning on releasing a DateTimeOffsetEditBox at some point.
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Phil,

The DefaultDropDownContentType is a read-only dependency property, so you shouldn't be using AddOwner for it (since you have no way to set it or override the property changed/coerce handlers).

You can register your own read-only dependency property with the same name for your DateTimeOffsetEditBox control and use that. The DateTimeEditBox tries to figure out the best drop-down content based on the current format, so you'd need to do something similar.

You could also just leave that property out of your control and change the drop-down content as needed (since that property and it's associated Style triggers are just there for convenience).


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.