Starting with the 14.2 version, the XtraEditors library contains TimeSpanEdit out of the box.
Obsolete:
This example shows how to create a TimeEdit descendant which will allow editing and displaying TimeSpan values, and entering more than 24 hours.
See Also:
How to create a custom editor that will allow editing TimeSpan values
Question Comments
Added By: Stefan Guc at: 6/7/2013 9:36:08 PM
Hi,
Can this be upgraded to v2013 vol 1.4.
Thanks,
Stefan.
Hello, I am waiting for 2013.1.4 upgrade.
Thanks Norbert
Hello All,
When I use this editor directly in a DevExpress.XtraBars.Ribbon.RibbonForm the Designer generates this code:
//
// tsEditDuration
//
this.tsEditDuration.EditValue = System.TimeSpan.Parse("00:00:00");
this.tsEditDuration.Location = new System.Drawing.Point(74, 50);
this.tsEditDuration.MenuManager = this.ribbon;
this.tsEditDuration.Name = "tsEditDuration";
this.tsEditDuration.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.tsEditDuration.Properties.DisplayFormat.FormatString = "HH:mm:ss";
this.tsEditDuration.Properties.EditFormat.FormatString = "HH:mm:ss";
this.tsEditDuration.Properties.Mask.EditMask = "HH:mm:ss";
this.tsEditDuration.Size = new System.Drawing.Size(100, 20);
this.tsEditDuration.TabIndex = 0;
So far everythings are fine.
But when I use this editor in a custom control derived from DevExpress.XtraEditors.XtraUserControl the Designer generates this code:
//
// tsEditDuration
//
this.tsEditDuration.EditValue = System.TimeSpan.Parse("00:00:00");
this.tsEditDuration.Location = new System.Drawing.Point(215, 110);
this.tsEditDuration.Name = "tsEditDuration";
this.tsEditDuration.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.tsEditDuration.Properties.DisplayFormat.FormatString = "HH:mm:ss";
this.tsEditDuration.Properties.EditFormat.FormatString = "HH:mm:ss";
this.tsEditDuration.Properties.EditValueChangedFiringMode = DevExpress.XtraEditors.Controls.EditValueChangedFiringMode.Default;
this.tsEditDuration.Properties.Mask.EditMask = "(0(\\R.([0-1]\\d|2[1-3])|\\d)|1(\\R.(0\\d|1[0-1])|\\d)|2\\d|3[0-5])\\R:[0-5]\\d\\R:[0-5]\\d";
this.tsEditDuration.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;
this.tsEditDuration.Size = new System.Drawing.Size(89, 20);
this.tsEditDuration.TabIndex = 14;
In the second case I can't edit the value. The EditMask string is displayed instead of the actual value. As a workaround you need to edit the designer generated code.
Regards,
Arnaud.
I have tried to replicate the issue but have not noticed any issues. If you still experience the same problem, please create a separate ticket regarding it and describe the issue in greater detail. A sample project demonstrating the problem will be very helpful.
Added By: Jackson Cheng at: 7/9/2014 3:10:17 AMHi,
How can I force the format to be like 00:00:00 instead of 0:00:00?
I tried changing the culture fed to the manager or the _Hxxx in FormatInfo but they seem to be the wrong place.
Thanks.
I have created a new ticket on your behalf and passed it to our team for research: How to change TimeSpan value format in the TimeEdit descendant class .
Added By: Trungpos SD at: 9/9/2014 1:54:57 AM
How can I export it to a .dll file?
Added By: Andrey (DevExpress Support) at: 9/9/2014 4:36:55 AMHello,
To accomplish this task, create a new Class Library project and then replace default code with custom control class code.
Should you have further questions, let me know.