Specify Work Item Form Controls
You can use the information that is provided in this topic as a quick reference to the Control element, its child elements, and attributes. For each field or form control that you want to display on a work item form, you add a Control element. You can customize a work item form to display information to help your team use the form correctly. You can add the work item fields and controls that enable you to enter and view the data that you want to track. The Control element provides nine values for the Type attribute that you can use to add fields or to display plain or hyperlinked text or fields. In addition, you can define special controls to add links and attachments, display Web-based content, or create your own control and add it to a work item form.
In this topic
Adding Work Item Fields to a Work Item Form
Adding Special Controls to a Work Item Form
Adding Custom Controls to a Work Item Form
Adding Work Item Fields to a Work Item Form
When you customize your work item form, you typically add a subset of the work item fields that are defined for the work item type that you want to appear on the form. The field definitions control many aspects of which data displays or which data that you can enter into the form. For more information, see Define Work Item Fields.
Each work item field is associated with a data type. You can use the information in the following table to determine which field type is supported by which Type attribute of the Control element. Use the Label attribute to specify the text that displays next to the control. Use the related LabelPosition attribute to specify where the label appears relative to the control. For more information, see Control the Display of Work Item Fields.
Note
You cannot change the values of system fields, which are updated automatically. For example, the Created Date and Created By fields are defined when a work item is first saved. However, you can use these fields in search criteria. For a description of each system field, see Work Item Field Reference for Visual Studio ALM.
Field type |
Control element Type attribute |
Usage |
---|---|---|
DateTime |
FieldControl DateTimeControl |
Use FieldControl to provide a text field for the input or display of a DateTime data type field.
Use DateTimeControl to provide a calendar picker to select a date for a field, as shown in the following illustration.
|
Double |
FieldControl |
Use FieldControl to provide a text field for the input or display of Double fields.
|
History |
WorkItemLogControl |
You use WorkItemLogControl to provide a control field for History fields that track discussion threads and other historical information, as shown in the following illustration. You can use this control only to support the display of the history field of a work item, the System.History work item field. By using this control, you can expand and collapse details about historical revisions to a work item. You can also format text that you add to the history field.
|
HTML |
HTMLControl |
Use HTMLControl to provide a control field that enable HTML fields to capture rich-text formatting, as shown in the following illustration.
|
Integer |
FieldControl |
Use FieldControl to provide a control field for an Integer field.
|
PlainText |
FieldControl |
Use FieldControl to provide a control field for a PlainText field, such as a text box that contains descriptions that may be larger than 255 characters.
|
String |
FieldControl |
Use FieldControl to provide a control field for a String field. String fields are limited to 255 characters.
|
TreePath |
WorkItemClassificationControl |
Use WorkItemClassificationControl to provide a control field for a TreePath field.
|
Optional Control Element Field Attributes for All Control Types
The following optional attributes can be specified only for those control types that are listed.
Attribute |
Description |
---|---|
Field |
Specifies the control that is associated with the work item field. |
Label |
Specifies the visible text on the form that identifies the control. Specify a string of no more than 80 characters. Note You can attach a hyperlink to the label of a field that is added to the work item form by using FieldControl. This control is useful for providing a link to information about how the field is used. For more information, see Provide Help Text, Process Guidance, Web Content, and Links to Web Pages on a Work Item Form. |
LabelPosition |
Specifies the position of the label that is relative to the control data. Specify a string from one of the following values: Top, Bottom, Left, and Right. |
Dock |
Specifies the alignment of the label with the specified side of the container, or stretches the field to fill the container. Specify a string from one of the following values: Fill, Top, Bottom, Left, and Right. |
Padding |
Specifies the amount of space, in pixels, around the inside border of the control. Four values are provided that correspond to the top, bottom, left, and right. For example: (2,0,2,0). |
Margin |
Specifies the amount of space, in pixels, around the outside border of the control. Four values are provided that correspond to the top, bottom, left, and right. For example: (2,0,2,0). |
ReadOnly |
Specifies that the field is read-only. Specify True or False. |
MinimumSize |
Specifies the minimum size, in pixels, that the control should occupy in the form. Two values are specified that correspond to the width and height. For example: (100,100). |
Name |
Uniquely identifies a control. The Name attribute is required if more than one control on the form is associated with the same work item field. Note You use the Name attribute to display the same field in more than one area on the form. You specify a unique value for the Name attribute for both control entries so that the system identifies each control uniquely. It is useful to show the same control in various locations based on the context of tabs. |
Optional Control Element Field Attributes for Specific Control Types
The following optional attributes can be specified only for those control types that are listed.
Attribute |
Control types |
Description |
---|---|---|
NumberFormat |
FieldControl |
Specifies the characters that you can enter in the field control. The following values are valid: WholeNumbers, SignedWholeNumbers, DecimalNumbers, and SignedDecimalNumbers. |
MaxLength |
FieldControl |
Specifies the maximum length of characters that you can use for a field control. |
Format |
DateTimeControl |
Specifies the format for the date-time field that corresponds to one value of the DateTimePickerFormat enum. The following values are valid: Custom, Long, Short, Time. |
CustomFormat |
DateTimeControl |
Specifies the custom format that is used for the date-time field that corresponds to the syntax that is defined for the DateTimePicker.CustomFormat property. |
Adding Special Controls to a Work Item Form
The following table describes the Control element Type attributes that provide support so you can manage the attachments of files, create links, display Web-based content, and view other data that is not associated with a work item field.
Control element Type attribute |
Usage |
---|---|
AttachmentsControl |
Use to attach files to a work item form. This control is usually contained in its own tab group, as shown in the following illustration. For more information, see Add the Attachments Control. |
LabelControl |
Use to display plain or hyperlinked text that is not associated with a field, as shown in the following illustration. You use the LabelText and Link child and container elements to specify the text, hyperlink, and position of a field or label whose text is partly associated with a hyperlink. For more information, see Provide Help Text, Process Guidance, Web Content, and Links to Web Pages on a Work Item Form, LabelText and Text XML Elements Reference, and Link and Param XML Elements Reference. |
LinksControl |
Use to create and manage links between work items. This control is usually contained in its own tab group, as shown in the following illustration. You use the LinksControlOptions to define the link filters and layout of column fields that are used to display the list of links. For more information, see Define Link Controls to Restrict Link Relationships and LinksControlOptions Elements. |
WebpageControl |
Use to display Web content in a work item form. This control is usually contained in its own tab group. You use the WebpageControlOptions and Link child elements to specify the controls that are required to load the Web page target in the work item form. For more information, see Add Web Content to a Work Item Form, WebpageControlOptions XML Elements Reference, and Link and Param XML Elements Reference. |
Adding Custom Controls to a Work Item Form
In addition to the built-in controls, you can add your own custom control to a work item form.
For example, you could add a custom control to capture a screenshot from the Clipboard. Or you could provide a control to capture multiple values by adding a check box for values that are presented in a list or menu.
To implement a custom control, you must specify the name of the control for the Type attribute. For more information, see the Microsoft Web site: Work Item Tracking Custom Controls.
See Also
Tasks
Add and Customize a Type of Work Item
Change the Work Item Form Layout
Add Web Content to a Work Item Form