Wednesday, December 14, 2011

Team Foundation Server WorkItem FieldControl Attributes

Probably the easiest way to customize a TFS WorkItem is by using the Process editor, a part of the TFS Power Tools. Using this editor you can add your own work item fields, customize the layout and change the corresponding workflow. Next to the obvious list of settings there are some less known things you can change using the Attributes property.

image

By using these attributes you can add custom attributes to the Work Item XML. Here are some useful attribute samples:

  • 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: 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.

No comments: