Compartir vía


LabelText and Text XML elements reference

Azure DevOps Server 2022 - Azure DevOps Server 2019 | TFS 2018 - TFS 2013

You can add a standalone label or informational text to a work item form by using the LabelText element. The label is not associated with any work item field. Optionally, you can add a hyperlink to some or all of the text.

To add elements to a form, you modify a work item type. See Modify or add a custom work item type.

The LabelText element is a child element of the Control element.

Syntax

<LabelText>  
   <Text>  
      <Link OpenInNewWindow="true | false" UrlPath="URLLinkWithParameters">  
         <Param index="IndexValue " value="ParamValue " type ="Original | Current"/>  
      </Link>  
      LabelText  
   </Text>  
</LabelText>  

Attributes and elements

The following sections describe attributes, child elements, and parent elements.

Child elements and attributes

Element Description
LabelText Required Control element when type="LabelControl".
Container element for a standalone label or informational text.

This element overwrites the value specified by the Label attribute specified by the Control element.
Text Required LabelText element.

Container element for the information or label to appear on the work item form. If the Link element is specified within the label, the portion of the text within the element is hyperlinked. If the Link element is not specified, the text is rendered without a hyperlink.

Different parts of the label text can be hyperlinked with different URLs. Multiple text element values can be specified in a series.


If the Text element is not specified, then the Control element Label attribute text appears on the work item form.
Link Optional Text element.

Container element for the hyperlink to be applied to a field or standalone label that appears on the work item form. The element type is HyperLinkType. Note: You must specify the Label attribute in a Control element when you specify a child Link element.
For more information, see Link and Param.

Parent elements

Element Description
Control Required. Defines a field, text, hyperlink, or other control element to appear on the work item form.

Remarks

You can combine plain and hyperlinked text by adding multiple Textelements in a LabelText element.

The LabelText element is only recognized by clients that are running Visual Studio 2015 or later comparable editions or versions. You specify the Label attribute in a Control element. For clients that are running Visual Studio 2015 or later comparable editions or versions, the text provided by the LabelText element appears in the work item form. For clients that are running earlier versions, the text specified by the Control element Label attribute appears in the work item form.

Example: Standalone label

The following example adds the plain text "Enter details about how to reproduce the bug in the space below:" to a work item form.

<Control Type="LabelControl" Label=" Enter details about how to reproduce the bug in the space below:">  
      <LabelText>  
      <Text>Enter details about how to reproduce the bug in the space below:  
      </Text>  
      </LabelText>  
</Control>  

The following example adds a hyperlink which is labeled "How do I use this work item?" to a work item form.

<Control Type="LabelControl" Label="How do I use this work item?">  
      <LabelText>  
      <Text>  
      <Link UrlRoot="http://www.live.com"></Link>  
      How do I use this work item?  
      </Text>  
      </LabelText>  
</Control>  

The following example adds a two-part label to a work item form. The first part, "Iteration Path", is associated with a hyperlink. The second part, "(must be 3 levels deep)" appears on the work item form as plain text.

<Control Type="FieldControl" FieldName="System.IterationPath" LabelPosition="Left">  
      <LabelText>  
      <Text>  
         <Link UrlRoot="@WssSiteUrl/render.aspx?wit=bug&topic=Iteration">  
         </Link>  
      Iteration Path  
      </Text>  
      <Text> (must be 3 levels deep)</Text>  
      </LabelText>  
</Control>