Creating a Work Item Custom Control is the way to accomplish what you're trying to do.
The project you already found (witcustomcontrols.codeplex.com) is a good starting point to understand the mechanics of creating work item custom controls, so I'll limit myself to describing the specifics of implementing the basics of a Custom Button.
Create a control that derives from System.Windows.Button and access the WorkItemDatasource property from the OnClick method.
This should get you started:
using System;
using System.Collections.Specialized;
using System.Windows.Forms;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Controls;
namespace Wicc {
public class ButtonControl: Button, IWorkItemControl {
public ButtonControl() {
}
protected override void OnClick(EventArgs e) {
WorkItem workItem = this.WorkItemDatasource as WorkItem;
// the rest of your code
}
#region IWorkItemControl Members
public event EventHandler AfterUpdateDatasource;
public event EventHandler BeforeUpdateDatasource;
public void Clear() {
}
public void FlushToDatasource() {
}
public void InvalidateDatasource() {
}
public StringDictionary Properties {get; set;}
public bool ReadOnly {get; set;}
public void SetSite(IServiceProvider serviceProvider) {
}
public object WorkItemDatasource { get; set; }
public string WorkItemFieldName { get; set; }
#endregion
}
}
In case you have further questions, let me know.