Yesterday I have created a Custom Control that one of its features is to open a work item for the user to modify.
Since it took me some time to understand how to do it I have decided to post a reference for how to do it in an easy way.
Here is an example of how to do it:
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Controls;
using Microsoft.TeamFoundation.Client;
using Microsoft.VisualStudio.TeamFoundation.WorkItemTracking;
private void ShowWorkItem(WorkItem wiActivity)
{
DocumentService docSrv = (DocumentService)serviceProvider.GetService(typeof(DocumentService));
IWorkItemDocument bugDocument = docSrv.CreateWorkItem(wiActivity, this) as IWorkItemDocument;
docSrv.ShowWorkItem(bugDocument);
}
private IServiceProvider serviceProvider; – is part of the IWorkItemControl interface that is required to create a Custom Control.
Have Fun!!!