Subscribe (RSS)

Quick Links

About Actipro

Actipro Software has been creating .NET user interface control products for Windows Forms since its inception. More recently, Actipro has become a pioneer in the .NET 3.0 WPF control development arena.
Friday, 19 June 2009 03:09 by Bill Henning (Actipro)

Editors for WPF - TimeSpanEditBox coming in next build

In the upcoming release we've added the TimeSpanEditBox control, which is a parts-based editor for the TimeSpan type. Like the other editors, setting it up is quick and painless. In addition, you can embed your own controls right inside it.

Parts

TimeSpanEditBox comes with parts for days, hours, minutes, seconds, milliseconds, ticks (fractions of a second), and the sign (positive or negative). Each part has an associated format specified, which is fully documented in our help file.  

Format Strings

One problem with the TimeSpan type is that it does not have native support for any formatting. When we built the parts-based editor for DateTime (and others), we built a parser for the native format strings so that arranging the parts and including literal strings would be intuitive and easy.

To work around this we defined our own format strings that can be used with the TimeSpanEditBox, which are modeled after DateTime's format strings. There are two types of format strings: standard and custom. Standard format strings are defined using a single character and offer the most common layouts. Custom format strings give you full control over the layout, and allow you to quickly embed literal text.

 TimeSpanEditBox   TimeSpanEditBoxCustomFormat

TimeSpanEditBox using the 'g' standard format string and a custom format string

You can also pad each parts with preceding zeros, just like with the DateTime formats.

TimeSpanEditBoxGFormat

TimeSpanEditBox using the 'G' standard format string which uses padding (except for Days part)

Spinning

All the parts have support for the spinner control and the up/down arrow keys. Like the DateTimeEditBox, you can configure how the control behaves with respect to spinning. For example, if the seconds part currently has focus and has a value of 59, then pressing the up arrow can result in three possible values. The first option is to prevent the value from changing (NoWrap). The second option is to wrap to 0, without affecting any other parts (SimpleWrap). Finally, the third option is to wrap to 0, but to also increment the number of minutes (Wrap).

Summary

TimeSpanEditBox has been one of our most requested parts-based editors and we hope you enjoy it!

Tags:   ,
Categories:   Actipro | New features | WPF
Actions:   Submit to DotNetKicks | E-mail | Permalink | Comments (2) | Comment RSS




Comments

Christian Wirth Germany

Yes! Good news!

June 22, 2009 at 09:00  

The Actipro Blog - WPF and WinForms Development

Actipro Blog 2009 Q2 posting summary

Actipro Blog 2009 Q2 posting summary

August 18, 2009 at 14:04  

Add comment



  Country flag

biuquote
  • Comment
  • Preview
Loading





We moderate all comments to block comment spam