Question

Efficiency editing Date, DateTime and Time Edit boxes

Posted 10 months ago by Avatar Bjørnar Sundsbø - Norway

Hello,

I've noticed you've made some progress on the DateTime, Date and Time EditBoxes in the 2017 version, but I currently have some issues with efficient input (in my opinion) for users who have to input data quickly. 

Say I want to enter the date July 13, 1980, I find it natural that I could just type 13071980, which should change into 13.07.1980 when I press tab. Even easier would be if I could input 130780, which would result in the same. Entering the time value 1057 which would be automatically converted to 10:57 would result in much faster input.

If I don't input the separators, the control reverts to today's date, or the last valid date. I'm not a big fan of intrusive validation messages and the kind, but I also don't want the user ending up with an incorrect value because of the default fallback value when he or she is in a hurry. Being able to enable a feature that would for instance switch the background to red, and animate a background color fade back to default color in a couple of secods could give valuable visual feedback. 

Any workaround you could suggest for allowing both input with and without separators? It would be very welcome if this could be available in a future version

On the plus side, I do enjoy that I don't have to press arrow keys to go to the next part, which made date and time very tedious in the past, but I would still like to be able to omit the separators, as I'm sure there are many users who find it natural to do so these days.


Bjørnar Sundsbø

Comments (14)

Posted 9 months ago by Actipro Software Support - Cleveland, OH, USA

Hi Bjørnar,

All the edit boxes have protected virtual TryConvertFromString methods that by default have our normal logic for parsing entered text values into the Value.  In this case, you want to add support for parsing other text values into the Value.  You could override our method, and first call the base method to see if the normal logic succeeds.  If it doesn't, you could kick in your own logic to parse the text and return a value.

We also will be adding some logic in the next build to try and help with this scenario for standalone dates and times that use the default format.  If a date text is 6 or 8 characters long and normal logic doesn't parse it, we'll try and inject separators and see if it parses.  If a time text is 4 characters long and normal logic doesn't parse it, we'll try and inject a separator and see if it parses.  These updates should help.


Actipro Software Support
Posted 9 months ago by Bjørnar Sundsbø - Norway

Thanks. When do you expect the update to available? 

In our Date and time boxes we have an inserted button in the template to allow for either a "set now" time or to clear the current value, depending on the current state of the textbox. This has been placed into the Checkbox slot. I lost my mojo on late friday evening when I noticed I had to retemplate the entire control, get converters, which key do I override, etc in the process. Are there triggers in the default template that could be moved to the style, so retemplating does not lose too much in case there are changes to templates in an update? I noticed there were som static resources that became a little bit tedious when I want to add my set current/clear button to DateTimeEditBox, DateEditBox and TimeEditBox.

I'm sure I'll manage when I find the time to do the rewrite to update to 2017 version, but in the meantime it would be very welcome to have an additional content property I can override in style to get something placed either between the spinner and popup button or to the right of the popup. I don't know if you want to add AdditionalContent and possibly AdditionalContentPlacement? That would make my day, as I have three EditBoxes I want to add the same functionality to.


Bjørnar Sundsbø
Posted 9 months ago by Actipro Software Support - Cleveland, OH, USA

Hello,

The next maintenance release should be out sometime this month.

Unfortunately at the moment, to add custom controls next to the textbox portion, you'd have to retemplate the control.  We wanted to keep the edit box as lean as possible by not adding additional content presenters, so that when many edit boxes are used, like in grid scenarios, could load up quickly.  If you had an easier way to add custom controls, would you want to do it via a DataTemplate?

I don't think putting buttons to the right of the popup button would be a good idea.  Do you think they should be left or right of the spinner?  Left of the spinner might be nice if someone wanted to display a unit type or something of that nature.  But buttons left of the spinner might be odd.


Actipro Software Support
Posted 9 months ago by Bjørnar Sundsbø - Norway

I don't have a preference about the placement of the additional content, but I suppose it might fit best to the right of the spinner. in our implementation, we currently do not use the spinner. I don't mind adding using DataTemplate. Would it be possible to expose a SetNowCommand and ClearCommand on the control, so the implementor could access it in whichever way suits them? Or alternative ideas might work as well. As long as I can place a new button inside the textbox, and set now/clear, I'm good :) But we managed to make it work with the current implementation, so I imagine I can figure it out on my own if those commands are not available.

Is it possible to include the DataTemplate for additional content in the next release? I'm not in a rush, so I could wait until the end of the month if I can avoid overriding the ControlTemplates I would be very happy.


Bjørnar Sundsbø
Posted 9 months ago by Actipro Software Support - Cleveland, OH, USA

Hello,

Right now the spinner and popup button at in a horizontal StackPanel.  It would be nice if we made a custom Panel instead that supported some form of sorting, perhaps via an attached property.  It could by default sort the spinner first and the popup button at the end.  The question is, how do we allow one or more custom controls to get injected into that Panel via public API, while still keeping the edit box as lightweight overall as possible?  Any thoughts on that?

BTW, there already is a ResetValueCommand on PartEditBoxBase, which can be user for a Clear button.  We will add a DateTimeEditBox.SetValueToNowCommand property for the next build.


Actipro Software Support
Posted 9 months ago by Bjørnar Sundsbø - Norway

A simple ContentPresenter might be the simplest, with logic similar to HeaderedContentControl.HasHeader, HasContent, to allow for some lightness (assuming I've got that one right). Presuming I could tell the control if I want the AdditionalContent before or after the spinner, I could insert however many buttons or additional content into AdditionalContent as I want, with the fact in mind that I can't place custom content on either side of the spinner. A single ContentPresenter might provide some additional flexibility, while still keeping it light. I don't know what kind of content other customers have used the different slots for in the past, so it's hard to tell how flexible the solution needs to be. All I need is to either show Set or clear button depending on the current state of the box, but imagine it would be nice to provide a nice and flexible solution so you don't need to change the API too much in the near future, in case new requests pop up.

I'll keep this in mind, and I'll consult with some people at work tomorrow to see if they have suggestions.


Bjørnar Sundsbø
Posted 9 months ago by Bjørnar Sundsbø - Norway

I didn't get any alternative suggestions at the office today. Have you had any additional ideas? Do you think it would be available in the next release? I'm still thinking ContentPresenter and DataTemplate might be the easiest. Of course, if you would want to include clear/set button as a default implementation, that would be awesome. I do however understand if you don't want to bloat the control with too many extra UI elements.


Bjørnar Sundsbø
Posted 9 months ago by Actipro Software Support - Cleveland, OH, USA

Hello,

We've tossed around some ideas on this and will try to work on it soon.  I'm not sure if it would make it in time for the next build yet.  We will post here again once we have some news.

We probably won't add a clear button option since WPF text controls don't have that out of the box.  As for the now button, the MonthCalendar dropdown has a Today button you can click in both DateEditBox and DateTimeEditBox that already provide some of that functionality.


Actipro Software Support
Posted 9 months ago by Actipro Software Support - Cleveland, OH, USA

Hello,

We were able to get an inline feature added for the next build 662.  It allows you to add a DataTemplate of whatever UI (e.g. buttons) you wish.


Actipro Software Support
Posted 9 months ago by Bjørnar Sundsbø - Norway

You guys rock!


Bjørnar Sundsbø
Posted 8 months ago by Bjørnar Sundsbø - Norway

Hey.

I've started migrating to the new controls, and I experience some minor issues:

- SetValueToNowCommand for DateEditBox should not set DateTimeNow; it should use DateTime.Today. Using the the value in search parameters might cause issues when using this command, as it will also include the time part, and therefore exclude entries before current time on a day in a From clause (I can work around this)

- It would be helpful with a HasInlines in case inlines are added to a style, but should not be displayed in some scenario. I've used an attached property for now, and not applying inlines to the style if this value is false. 

- Input without separators doesn't seem to work when using custom formats

- Input without separators does not appear to work with DateTimeEditBox

- I miss the AnalogClock for display only puprposes, but I suppose I can restyle the TimePicker for display purposes based on the style in the old control. Perhaps a IsReadOnly that could display the clock without radial sliders and make it less intrusive? Perhaps not necessary to spent time working on this if I'm the only one with this request.

[Modified 8 months ago]


Bjørnar Sundsbø
Posted 8 months ago by Actipro Software Support - Cleveland, OH, USA

Hello,

In the future, do you mind posting separate unrelated issues in new threads?  It's difficult to track work when there are many issues reported in long threads.  Thanks!

1) I'm not sure we should modify the SetValueToNowCommand property in DateEditBox, since it inherits up from DateTimeEditBox.  Perhaps adding a new SetValueToTodayCommand property would be better?

2) Correct, input without separators for custom formats won't work.  You would have to override TryConvertFromString and add your own logic for that scenario.

3) Correct, input without separators for DateTimeEditBox won't work.  Our logic for that only support date-only or time-only.  You can add your own logic in a TryConvertFromString override if you want.

4) What in general do you use the read-only clock for in your app?  You could always set the TimePicker's IsEnabled property to false to block input.


Actipro Software Support
Posted 8 months ago by Bjørnar Sundsbø - Norway

Sorry about that. Now that you mention it, I'm not a big fan of all in one bug reports either. Thank you for your quick response. I just wanted to make you aware of this, as they were on the existing topic.

1) Moving it to the spesific implementations would probably work the best, and should not be a breaking change

2) I'm ok with that. We don't really use custom formats that much in any case, so it's not really an issue. Just thought I would mention it

3) I can work with that, and implement what I need when I need it

4) We display it in the ribbon for our users who in work with emergency dispatch, was used to get rid of the previously used floating analog clock app they used for their purpose. I have created a new analog clock, so the case is closed on our end now. It was easier than I suspected at first. I also think this is a special use case, so it is probably unlikely that you get a lot of user requests for this feature.


Bjørnar Sundsbø
Posted 8 months ago by Actipro Software Support - Cleveland, OH, USA

Hello,

We've added this for the next build:

  • Added the DateTimeEditBox.SetValueToTodayCommand property, that resets the Value to DateTime.Today when executed.

Actipro Software Support
Information The latest build of this product (2018.1 build 0671) was released 1 month ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.