The latest maintenance release of WPF Studio (build 501 that came out today) includes several enhancements and bug fixes in the Editors for WPF product. We've already discussed the new TimeSpanEditBox control, but some of the other key updates are described below.
Clipboard operations on PartGroup
One of our most requested features was to add better support for clipboard operations (i.e. copy and paste) in the parts-based editors. Previously, controls like DateTimeEditBox only allowed you to copy/paste text from within the individual parts. There was no way to copy the entire value of the DateTimeEditBox, so we've added a way.
Before we got to clipboard operations, we needed a way for the user to "select" the entire value or text. Therefore, we added the ability to select the associated part group, since it hosts all the discrete parts. When there is a single part in the part group, then a single Ctrl+A (or selecting all of the text using the mouse) will select the part group. Since there is a single part, there is no need to allow the part's text to be selected separately. If there are several parts in the part group, then the first Ctrl+A will select all the text in the active part and the second Ctrl+A will select the part group. Subsequent Ctrl+A will toggle between these two modes.
|   DateTimeEditBox with the year selected (top) and the part group selected (bottom) |
When the selection is completely contained in a part, then copy/cut/paste will function as it did previously. These operations will simply copy/cut/paste the selected text in the given part. However when the part group is selected, then copy/cut/paste will operate on the associated value. In the images above, pressing Ctrl+C with the year selected will put the text "2009" on the clipboard. When pressing Ctrl+C with the year selected will put the text "7/1/2009 11:12 AM" on the clipboard.
By default, the text copied to the clipboard by the part group uses the same format as presented in the control (as specified by the Format property). You can customize this format by setting the ExportFormat property to a different format. Although, you should typically leave ExportFormat set to null, which indicates that Format should be used (but it's there if you need it). We've also built in some other customization features, which are documented in our help file.
We've added a bit more flexibility (where we could) when pasting a value on to a selected part group. For example, with the DateTimeEditBox you can paste a date in one of several formats and the control will try to figure out what format the text is in. If you paste the string "April, 2010" (which is the 'm' standard DateTime format specifier) in the DateTimeEditBox pictured above, the resulting value is "4/1/2010 12:00 AM" (which is the result of the DateTime.Parse method on the given string).
|  DateTimeEditBox after pasting "April, 2010" on the selected part group |
Finally, when pasting a value, only editable parts will be updated. So if the month part was not editable, then in the above scenario it would have remained July (or 7).
Setting to null
The value of a type-specific parts-based editor can be set to null by the user in a number of ways.
The first method is to use the null CheckBox, which can be included by setting CheckBoxVisibility to Visible. The CheckBox allows the user to set the value to null and to re-initialize it to a non-null value (as indicated by the InitialValue property). The CheckBox also gives the user a visual indication of whether the value is null.
Another method is include a custom Button, which uses the NullifyValue command. This allows the user to set the value to null using a single mouse click. One of the QuickStarts in our Sample Browser shows how this can be done.
Finally, we've added the ability to set the value to null by deleting all the text, which is controlled by the new property IsNullAllowed. When this value is true, if the user deletes all the text in a part or presses the Delete key when the associated part group is selected, then the value will be set to null. If this value is false (the default), then the value will not be set to null and will revert back to it's previous value if the user tries to commit the change.
Support for NaN and Infinity
The DoubleEditBox, PointEditBox, RectEditBox, SizeEditBox, and VectorEditBox controls now support NaN and Infinity, both positive and negative, values. These values are presented, and can be entered by the user, using NaNSymbol, PositiveInfinitySymbol, and NegativeInfinitySymbol from the NumberFormat of the current culture. These are typically "NaN", "Infinity", "-Infinity", but may vary depending on the current culture.
| DoubleEditBox showing NaN value |
Since the parts-based editors leverage the MaskedTextBox, the user only needs to type the first character to set the associated value. For example, the user can type "N" to set the value to NaN, since the MaskedTextBox will auto-complete the remaining characters.
To enable support for these values you simply need to set AllowNaN and/or AllowInfinity to true. By default, AllowInfinity indicates that both positive and negative Infinity are valid. If the Minimum is set to a positive number (including 0), then negative Infinity will not be allowed.
Horizontal Alignment
The parts-based editors are capable of hosting any custom content in one of three slots: left, center, and right. Typically, the center slot is reserved for the "main" content. For the type specific editors (e.g. DateTimeEditBox), the center slot holds the default part group (which presents the associated value as text). The editors already offered a lot of control over the layout of the items and slots, but you could not easily align the text to the right side of the control. To fix this we've added a CenterSlotHorizontalAlignment property, which can be used to align the default part group (and thus the text) to the right side of the control.
| DoubleEditBox with the text right-aligned |
Summary
In addition to the features above, we've fixed several issues that popped up in the first release. So be sure to check out the latest version, available now.