Azure DevOps Server |Azure DevOps Server 2022
當您自訂工作專案表單時,您可能想要提供資訊或內容連結,以協助小組定義表單中的欄位。 如果您在表單中嵌入資訊或使其易於使用,團隊成員將能夠更好地追蹤有用的資料。
藉由使用本主題中所述的表單控制項,您可以新增個別欄位的工具提示文字、獨立文字或網頁的超連結,或在表單中內嵌 HTML 內容或網頁內容。
若要修改現有的 WIT,您可以修改 WIT 的 XML 定義檔,然後 根據您使用的程式模型將它匯入至您的專案。
小提示
使用 witadmin,您可以 匯入和匯出定義檔案。 您可以使用的其他工具包括 [進程編輯器] (需要您已安裝 Visual Studio 版本)。 從 Visual Studio Marketplace 安裝程序範本編輯器。
提供說明文字或工具提示文字
您可以使用以下兩種方式之一提供說明文字。 在第一種方法中,您可以將 HELPTEXT 元素作為子項 FIELD 新增至類型定義區段中的 FIELDS 元素。 使用 HELPTEXT,您可以建立欄位的工具提示。 使用此方法的字元限制為 255 個字元。
<FIELD name="Sub-Title" refname="ACME.ACE.ImpactStatement" type="HTML" >
<HELPTEXT>Provide information about the impact to the ACE organization. </HELPTEXT>
</FIELD>
在第二種方法中,您可以使用 和LabelTextText子元素來指定獨立文字。 在此方法中,您可以添加任意數量的信息,並且文本始終存在於表單上。 使用者不必採取任何動作。 您也可以使用元素新增至 Link 詳細資訊,以新增選用連結,如下列範例所示。
<Control FieldName=" ACME.ACE.ImpactStatement" Type="HTMLControl" Label="Impact" LabelPosition="Left">
<LabelText>
<Text>Provide information about the impact to the ACE organization. Specifically address the following: customer segment, target strategic opportunity, resources required, and time dependencies. For more detailed information, see the Impact Statement specification at:
<Link OpenInNewWindow="true" UrlRoot=http://ACE.ImpactStatement.aspx />
</Text>
</LabelText>
</Control>
新增獨立文字和超連結欄位標籤
您可以使用元素的Type屬性LabelControl選項,Control將文字新增至未與任何工作專案欄位相關聯的工作專案表單。 文字可以是純文字,也可以提供超連結。 此外,您可以使用選項 FieldControl 將超連結附加至新增的欄位標籤。
範例:純文字標籤
以下範例新增純文字「在此處填寫錯誤的詳細資訊。 建議填寫不需要的欄位。」 新增至工作項目欄位。
<Control Type="LabelControl" Label="Fill in the details of the bug here. Fields that are not required are recommended to be filled in." />
範例:超連結欄位標籤
下列範例說明如何將超連結新增至欄位標籤。
<Control Type="FieldControl" FieldName="System.Title" LabelPosition="Left" Label="Title 1"
<LabelText>
<Text>
<Link UrlRoot="http://www.live.com/" />
Title 2
</Text>
</LabelText>
</Control>
備註
對於尚未升級至最新版本的 Team Foundation 用戶端, Label 屬性文字隨即顯示。 針對 Visual Studio 2012 用戶端,Text 標籤會顯示為超連結,其中 URL 是由標籤所 Link 定義。
範例:欄位標籤,其中包含部分文字的超連結
下列範例說明如何將超連結新增至欄位標籤的一部分。 在此範例中,URL 是由根據特定工作專案指派給 Param 元素的值所決定。
<Control Type="FieldControl" FieldName="System.IterationPath">
<LabelText LabelPosition="Left">
<Text>
<Link UrlRoot="@ProcessGuidance" UrlPath="{0}.html">
<Param Index="0" vValue"System.WorkItemType"/> </Link>
Iteration Path
</Text>
<Text> (must be 3 levels deep)</Text>
</LabelText>
</Control>
範例:超連結文字標籤
超連結文字標籤
下列範例說明如何新增超連結以在工作專案表單中顯示的文字。
<Group>
<Column PercentWidth="100">
<!-- Standalone label control 2 -->
<Control Type="LabelControl" Label="How do I use this work item?">
<Link UrlRoot="http://www.live.com"></Link>
</Control>
</Column>
</Group>
範例:將文字和超連結合併到單一標籤中
將文字和超連結合併到單一標籤中
下列範例說明如何將兩個超連結新增至工作專案表單上標籤的各個部分。
<Group>
<Column PercentWidth="100">
<!-- Standalone label control 3 -->
<Control Type="LabelControl" Name="Microsoft.VSTS.Common.GuidanceLabel3">
<LabelText>
<Text>Click here for </Text>
<Text>
<Link UrlRoot="http://www.msn.com"></Link>
work item guidance</Text>
<Text> or here for </Text>
<Text>
<Link UrlRoot="http://www.msdn.com"></Link>
process guidance
</Text>
</LabelText>
</Control>
</Column>
</Group>
範例:參數產生的超連結欄位標籤
下列範例說明如何將超連結新增至欄位標籤,該標籤是從針對開啟工作專案評估的參數值所產生。
<Control Type="FieldControl" FieldName="System.State" Label="&State:" LabelPosition="Left">
<Link OpenInNewWindow="true" UrlRoot="http://" UrlPath="myserver.com:8080/tfs/myproject/{0}/_workItems#_a=edit&id="> <Param Index="0" Value="System.State" Type ="Original"/>
</Link>
</Control>
顯示網頁內容
您可以使用 Type 屬性 WebpageControl 選項,將工作專案表單中的網頁內容顯示為控制項,而不是連結至個別的網頁。 此顯示可用於提供度量,以支援小組成員檢視報表、儀表板或其他 HTML 型內容的內容。 您可以提供內容的連結,或將原始HTML內容內嵌在CDATA標籤中。
範例:顯示 URI 所提供的內容
下列範例顯示如何使用 和 WebpageControlOptionsLink 元素提供頁面的 URL,以內嵌網頁的內容。
<Group>
<Column PercentWidth="100">
<Control Type="WebpageControl" Name="WssPortalPage" Label="WssPortalPage" LabelPosition="Top" >
<WebpageControlOptions AllowScript="true">
<Link UrlRoot="http://www.msdn.com" />
</WebpageControlOptions>
</Control>
</Column>
</Group>
範例:顯示CDATA標籤中提供的內容
下列範例示範如何將 HTML 內容新增至標籤中包含的 CDATA 工作專案表單。
<Control Type="WebpageControl">
<WebpageControlOptions>
<Content>
<![CDATA[Place HTML Formatted Content Here ]]>
</Content>
</WebpageControlOptions>
</Control>