I'm using the UltraDateTimeEditor as a time editor
(MaskInput="{LOC}hh:mm tt"; FormatString="hh:mm tt"; SpinButtonDisplayStyle=Always;)
and would like the AM/PM to change when I click the spin buttons (for the hour portion and go from 11->12 and 12->11. (I see this behaviour using the standard WinForms DateTimePicker control and would like to get the UDTE control to do the same.)
I initially tried to use the EditorSpinButtonClick() event and just manually track when the value changes from 11 to 12 but I am not receiving that event when I click on the spin buttons (this seems like a bug). Is there some flag I need to set in order to receive this event?
Anyone know how to get the AM/PM to roll?
Thanks,
- Josh
Hi Josh,
The standard spin button that you see on the DateTimeEditor is not an EditorButton. This button is built-in to the control. The EditorButtons are something else. These are buttons that you add to the ButtonsRight or ButtonsLeft collection of the control.
So if the standard button doesn't spin the AM/PM sign, then what you can do is hide it. I beleive there's a property called SpinButtonLocation which you can set the None.
Then you could add a SpinEditorButton to the ButtonsRight collection on the control and handle the EditorSpinButtonClick event to control the behavior however you want.
Thanks Mike,
That seems like a step backwards.
I did add a SpinEditorButton to the ButtonsRight collection and it shows up and I do get the EditorSpinButtonClick event now. However, I would have to replicate all the functionality of the built in spin button (increasing/decreasing the various date/time elements, handling wrap around for those elements). I would hate to have to code up all that pre-existing functionality.
I wonder now if that's the best way to get the AM/PM to roll when the hour transitions from 11<->12. Seeing as the standard WinForms DateTimePicker does this, I was hoping there would just be some property that I've missed on the Infragistics control that would mimic the same behaviour.
Failing that, is there a different event I can subscribe to that triggers when the built in spin buttons are pressed?
Hi,
Well, the built-in spin buttons are all or nothing. There's no way to modify the behavior. So you either have to use the built-in spin button and take the functionality as-is, or use an editorbutton and write all of the spin logic yourself.
Having said that, I think I misunderstood the problem. I thought you were trying to spin the AM/PM by itself. I didn't realize you meant you were spinning the hour. I tend to agree with you that the AM?PM should change when the hours spins around. I'm not sure why it doesn't.
I recommend reporting this to Infragistics Developer Support so they can check it out. I could be wrong,maybe it's done this way for a reason, but maybe this is a bug.
Get Help
Is this bug be fixed?