在工作項目表單上提供說明文字、流程指引、Web 內容和網頁的連結

在自訂工作項目表單時,您可能想要提供資訊或內容連結,協助小組定義表單上的欄位。 如果您嵌入資訊的格式或輕鬆地將其設定為可用,小組成員可以更有效地追蹤有用的資料。

透過使用本主題中說明的表單控制項,您可以加入個別欄位的工具提示文字、獨立文字或網頁的超連結,或在表單中內嵌 HTML 內容或 Web 內容。

您可以修改工作項目類型的定義修改工作項目表單。 您可以使用 witadmin 命令列工具,請參閱 自訂和管理工作項目類型 [witadmin]或流程編輯器。

處理編輯器是您可以下載及安裝 Visual Studio 的強大工具增益集。 位於工具功能表之下,處理編輯器中自訂在 Team Foundation Server 使用的物件追蹤工作項目的物件提供圖形化使用者介面。 您可以使用這個工具匯入和匯出工作項目類型,也可以用來修改這些物件的定義。 如需詳細資訊,請參閱下列 Microsoft 網站的網頁:Team Foundation Server Power Tools (英文)。

提供說明文字或工具提示文字

您可以用兩個方式來提供說明文字。 第一個方法就是在型別定義的 FIELDS 區段 FIELD 項目中,加入 HELPTEXT 項目做為子項目。 使用 HELPTEXT 來建立欄位的工具提示。 使用這個方法,欄位的限制是 255 個字元。

<FIELD name="Sub-Title" refname="ACME.ACE.ImpactStatement" type="HTML" >
<HELPTEXT>Provide information about the impact to the ACE organization. </HELPTEXT>
</FIELD>

第二個方法是使用 LabelText 和 Text 子項目指定獨立文字。 使用這個方法,您可以視需要加入資訊且長度不限,文字一定會顯示在表單上。 使用者不需要執行任何動作。 您也可以使用 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>

加入獨立文字和超連結欄位標籤

您可以使用 Control 項目的 Type 屬性 LabelControl 選項,將文字加入至與任何工作項目欄位都沒有關聯的工作項目表單。 此文字可以是純文字或提供超連結。 此外,您也可以使用 FieldControl 選項,將超連結附加至已加入的欄位標籤。

Ff731584.collapse_all(zh-tw,VS.110).gif範例:純文字標籤

下列範例會將純文字 "Fill in the details of the bug here. Fields that are not required are recommended to be filled in." 加入至工作項目欄位。

<Control Type="LabelControl" Label="Fill in the details of the bug here. Fields that are not required are recommended to be filled in." />

Ff731584.collapse_all(zh-tw,VS.110).gif範例:超連結欄位標籤

下列範例示範如何將超連結加入至欄位標籤。

<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 標記會顯示為內含 Link 標記所定義之 URL 的超連結。

Ff731584.collapse_all(zh-tw,VS.110).gif範例:與超連結的欄位標籤中的文字

下列範例示範如何將超連結加入至欄位標籤的一部分。 在這個範例中,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>

Ff731584.collapse_all(zh-tw,VS.110).gif範例:超連結文字標籤

超連結文字標籤

套用至單獨標籤的超連結範例

下列範例示範如何將超連結加入至工作項目表單中顯示的文字。

<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>

Ff731584.collapse_all(zh-tw,VS.110).gif範例:結合文字和超連結在單一標籤

在單一標籤中結合文字和超連結

兩個套用至文字的超連結範例

下列範例示範如何在工作項目表單上將兩個超連結加入至一個標籤的某些部分。

<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="https://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>

Ff731584.collapse_all(zh-tw,VS.110).gif範例:參數產生的超連結欄位標籤

下列範例示範如何在評估開啟的工作項目之參數值後產生的欄位標籤中,加入超連結。

<Control Type="FieldControl" FieldName="System.State" Label="&amp;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>

顯示 Web 內容

您可以使用 Type 屬性 WebpageControl 選項,在工作項目表單中將 Web 內容顯示為控制項,而非連結到個別的網頁。 此顯示很適合用於提供度量資訊,支援小組成員檢視報表內容、儀表板或其他 HTML 內容。 您可以提供內容的連結,或是在 CDATA 標記中內嵌原始 HTML 內容。

Ff731584.collapse_all(zh-tw,VS.110).gif範例:提供 URI 的顯示內容。

下列範例示範如何使用 WebpageControlOptions 和 Link 項目,透過提供網頁 URL,來內嵌網頁內容。

<Tab Label="Web">
   <Group>
      <Column PercentWidth="100">
         <Control Type="WebpageControl" Name="WssPortalPage" Label="WssPortalPage" LabelPosition="Top" Dock="Fill">
            < WebpageControlOptions AllowScript="true">
               <Link UrlRoot="http://www.msdn.com" />
            </WebpageControlOptions >
         </Control>
      </Column>
   </Group>
</Tab>

Ff731584.collapse_all(zh-tw,VS.110).gif範例:在 CDATA 標記中提供的顯示內容。

下列範例示範如何將 HTML 內容加入至 CDATA 標記所包含的工作項目表單。

<Control Type="WebpageControl">
   <WebpageControlOptions>
      <Content>
      <![CDATA[Place HTML Formatted Content Here ]]
   </Content>
   </WebpageControlOptions >
</Control>

內嵌的流程指引

若要在工作項目表單上提供流程指引,您可能想要加入索引標籤,其中包含工作項目類型的工作流程和使用方式資訊。 您可以使用 Type 屬性 WebpageControl 選項執行此動作。 這個選項支援使用 WebpageControlOptions 和 Content 子項目,將 RTF 文字和影像內嵌至表單。

<FORM>
. . .
<TabGroup>
. . . 
   <Tab Label="Process Guidance">
      <Group>
         <Column PercentWidth="100">
            <Control Type="WebpageControl">
            <WebpageControlOptions >
            <Content>
               <![CDATA[Place HTML Formatted Process Guidance Content Here ]]>
            </Content>
            </WebpageControlOptions>
            </Control>
         </Column>
      </Group>
   </Tab>
. . .
</TabGroup>
. . .
</FORM>

請參閱

概念

設計工作項目表單的配置

自訂專案追蹤資料、表單、工作流程和其他物件