在工作項目表單上提供說明文字、超連結或 Web 內容

當您自訂工作項目表單時,可能想要提供資訊或連結,協助您的小組定義表單中的欄位。 如果您在表單上內嵌資訊或讓它易於使用,小組成員會更能夠追蹤有用的資料。

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

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

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

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

您可以使用下列其中一種方式來提供說明文字。 第一個方法就是在型別定義的 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>

在第二個方法中,您可以使用 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 選項,將超連結附加到已加入的欄位標籤。

範例: 純文字標籤

下列範例會將下列這段純文字:「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." />

範例: 超連結欄位標籤

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

<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 的超連結。

範例: 部分文字含有超連結的欄位標籤

下列範例說明如何將超連結加入部分的欄位標籤。 在此範例中,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="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>

範例: 參數產生的超連結欄位標籤

下列範例說明如何將超連結加入從針對開啟工作項目進行評估之參數值產生的欄位標籤。

<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 內容。

範例: 顯示 URI 所提供的內容

下列範例示範如何使用 WebpageControlOptions 和 Link 項目,藉由提供頁面的 URL,內嵌來自網頁的內容。

<Tab Label="Web">
   <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>
</Tab>

範例: 顯示 CDATA 標記中提供的內容

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

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

內嵌流程指引

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

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

請參閱

概念

設計工作項目表單

自訂工作追蹤物件以支援小組的流程