I'm using NetAdvantage version 9.1.20091.2012
I have an UltraDateTimeEditor which is data binded to a business object that exposes a property "StartTime" of type DateTime? (nullable DateTime). When the business object is created the default value of the property is null.
I'm only interested in the time part of the DateTime, so the StartTime property has to be be higher or equal than 01/01/2000 12:00:00 AM and lower or equal than 01/01/2000 11:59:00 PM. I'm setting the MinDate and MaxDate of the editor to those values.
I want the spin buttons visible, so they are enabled and the SpinIncrement is 1 minute.
In the attached sample application there are two editors with the configuration described above. The one on the top (let's call it dte1) displays Date and Time. The one on the bottom (let's call it dte2) only displays Time and that's the one I intend to use in my application.
I noticed the following behaviors:
1) When I type a time in dte2 and tab out of the control the value is not accepted and remains null. The spin buttons are enabled when I tab in. As soon as I click any of them they become disabled and the time changes 1:00 AM. If I tab out the value is discarded and remains null. That tells me the date part was not being set when the MaskInput includes time only.
Question: What's the right way to deal with the Time part only and set the Date part to a predefined value when changing from null to not-null?
2) When I tab into dte1 the spin buttons are enabled. If I click the up arrow the value changes to 01/01/2000 01:00 AM, which is a valid value. In test 1) that doesn't happen. For dte2 the spin buttons are disabled instead.
Is there a way to get that behavior in dte2?
3) With dte1 set to null, when I tab into dte1 and click the down spin button the time changes to 11:59 PM. That's fine because that's my MaxDateTime. Now I set dte1 to null again, tab into the control and click the up spin button. The Time changes to 1:00 AM. It should change to 12:00 AM right?
4) Right after dte1 changes to 1:00 AM in test 3), the down spin button is disabled, as if 1:00 AM was the minimum value, which is wrong. 12:00 AM is the actual minimum value, so the down arrow should be enabled until I reach 12:00 AM, not 1:00 AM.
5) I enabled SpinWrap in dte1, then click the spin up arrow. When I reach 11:59 PM it wraps to 1:00 AM. It should wrap to 12:00 AM instead.
6) If I type 12:30 AM in dte1 and click the up spin arrow it changes to 12:31 AM. That's fine. Now if I click the down arrow it changes to 1:00 AM. It should change back to 12:30 AM.
I think those are many unexpected behaviors. Maybe I'm missing something?
Any help Infragistics or other users can provide is greatly appreciated.
Thanks,
Oscar.
The .NET data binding layer can't handle nullable types, so that is part of the problem. The MinDate/MaxDate settings are also causing a problem; the time components of that property are not used so the control interprets this as no date being valid .
Also the way you have the JOJO.StartTime property declared is probably not as intended; it looks like abstract notation, with no implementations for the get or set method. The data binding layer is choking on this, so that is another part of the problem.
Thanks for your answer Brian.
I don't think this is a binding problem, but the way the editor handles the transition from null to a not null value.
The JOJO.StartTime property is not the problem either. It is declared as an Auto-implemented property:
http://msdn.microsoft.com/en-us/library/bb384054.aspx
I've been trying diferent solutions, and this is what I found out:
1) There's no automatic workaround for this. In my case I decided to add a checkbox next to my editor. If the user checks it I set the editor.Value to MinDate. If the user unchecks it I set the editor.Value to null. Dirty, but works. A better solution would be adding a custom spin button to the control and handle the logic to go from MaxDate-null-MinDate when clicking the up arrow, or MinDate-null-MaxDate whn clicking the down arrow. Now that I think about it this would be a nice feature. I'll submit a feature request.
2) I couldn't find an explanation for this one. It looks like the Date part is not set when clicking the up arrow if the MaskInput is not present. That's a bug in my opinion. Can you confirm this? If so, I'll report it as a bug.
3) and 4) It looks like the control is usign a numeric sequence (1 is the minimum, 12 is the maximum) instead of a time-aware sequence (12 AM is the minimum, followed by 1 AM... and 11 PM is the maximum). This is not necessarily a bug, but it's not intuitive. What do you think?
5) and 6) It's clear to me these are bugs.