Undocumented attributes for controlling the Work Item form layout

Naren [1] revealed a few very interesting on hidden attributes his blog [2] which you definitely should take a look at since they let you solve some problems as the following ones:


Control the height of two text boxes that were placed vertically on one tab


When placing more than one text box on a tab page you will notice that all text boxes have the same height except the last one which can be annoying if you use HTML and expect the writer to write a lot.

Undocumented3

Using the “MinimumSize” attribute in the Work Item Type XML you can specify the minimum width and height that the control has to have.

Undocumented5

Resulting in a much more nice looking writing experience:

Undocumented4


Show the same field twice in different places


Sometimes it makes sense to place the same field on two places for example in the general area as well as on a tab. If you do so you would get an error.

Undocumented8

You can use “Name” attributes with different values to allow the field to be displayed multiple times.

Undocumented6
Undocumented7

This leads to the desired effect. Note that if you enter something in the one field it will automatically appear in the other text field after leaving the control.

Undocumented1


So here’s the background by Naren. A must read for people customizing Work Item types:


<Control FieldName=”control name” Type=”FieldControl | DateTimeControl | HtmlFieldControl | LinksControl | AttachmentsControl | WorkItemClassificationControl | WorkItemLogControl” Label=”label text” LabelPosition=”Top | Bottom | Left | Right” Dock=”Fill | Top | Bottom | Left | Right” Padding=”(left, top, right, bottom)” Margin=”(left, top, right, bottom)” ReadOnly=”True | False” />

 

Attributes that weren’t documented:

 

MinimumSize: The minimum size the control should occupy in the form. If vertical space is not enough, then a scrollbar is shown to keep its minimum size. Without this attribute, the controls are drawn with their default sizes (unless controls in other tabs take larger space that incrasing whole tab’s size). The syntax for it’s value is “(width,height)” (In regex format it is “^\(\d+\,\d+\)$”).

 

Name: If you want to add same field to be displayed in more than one place, it is possible but the Name attribute should be set to unique values for both – so that the system identifies each control uniquely. It is useful to show same control in various places based on context of tabs.

 

[Update: 3/12/07]

Below are special attributes available for specific controls:

NumberFormat (for FieldControl only): Useful if a number value is displayed in the field. Possible values: WholeNumbers, SignedWholeNumbers, DecimalNumbers, SignedDecimalNumbers. Setting this attribute determines what characters are allowed to be entered in this control.

 

MaxLength (for FieldControl only): Maximum length of allowed characters for field control in form UI.

 

Format (for DateTimeControl only): One of values of DateTimePickerFormat enum. Possible values as given in help are: Long, Short, Time and Custom. Custom format can be set by having ‘Custom’ as value for this attribute, and setting another attribute named CustomFormat with actual custom format string.


[1] http://blogs.msdn.com/narend/


 


[2] http://blogs.msdn.com/narend/archive/2007/02/09/hidden-attributes-to-control-your-work-item-form-layout.aspx

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>