次の方法で共有


Controlling which link types are displayed on a work item form

In 2005 and 2008 versions of TFS, the work item links control that displayed the links always showed all the links. For TFS 2010, we made a design decision based on the fact that whoever is designing a work item form, may want to display certain link types separately from other link types.

For example, let's say you have a tab on the work item form which manages your dependent features. It would make sense that the links control on that tab only display links to dependent features.

This is where the new filtering functionality with the links control comes in.

In the work item type XML in 2005/2008, this is what you did when you wanted to display a links control:

<Control Type="LinksControl"/>

With 2010, we’ve add the LinksControlOptions section to allow you to filter what link types to include. Of course, this is all documented on MSDN, but below is a summary.

The simple example would render a links control that includes all work item links (Related, Parent/Child), and exclude any non-work item links (ChangeSets, Hyperlinks, Test Results):

<Control Type="LinksControl" Name="UniqueName">

   <LinksControlOptions>

    <WorkItemLinkFilters FilterType="includeAll" />

    <ExternalLinkFilters FilterType="excludeAll" />

</LinksControlOptions>

</Control>

The following example would render a links control that displays only Requirement and Hierarchy links.

<Control Type="LinksControl" Name="UniqueName">

  <LinksControlOptions>

<WorkItemLinkFilters FilterType="include">

<Filter LinkType="MyLinks.LinkTypes.Requirement" />

<Filter LinkType="System.LinkTypes.Hierarchy" />

</WorkItemLinkFilters>

<ExternalLinkFilters FilterType="excludeAll" />

</LinksControlOptions>

</Control>

The following example would render a links control that displays all work item links except Requirement and Hierarchy links.

<Control Type="LinksControl" Name="UniqueName">

  <LinksControlOptions>

<WorkItemLinkFilters FilterType="exclude">

<Filter LinkType="MyLinks.LinkTypes.Requirement" />

<Filter LinkType="System.LinkTypes.Hierarchy" />

</WorkItemLinkFilters>

<ExternalLinkFilters FilterType="excludeAll" />

</LinksControlOptions>

</Control>

The following example would render a links control that displays only Change Set links.

<Control Type="LinksControl" Name="UniqueName">

  <LinksControlOptions>

<WorkItemLinkFilters FilterType="excludeAll"/>

<ExternalLinkFilters FilterType="include" />

<Filter LinkType="Change Set" />

</ExternalLinkFilters>

</LinksControlOptions>

</Control>

That should give you a pretty good idea of what can be done.

Comments

  • Anonymous
    November 10, 2010
    Is there anyway to specify the sort order in a Links Control?

  • Anonymous
    June 13, 2011
    "The order in which the elements are listed defines the order in which the column fields are displayed in the work item form" according to msdn.microsoft.com/.../dd638522%28VS.100%29.aspx