|
Hello all!
When creating a new bug in Team Explorer, you have an Area: field that holds a nice dropdown that includes a look-a-like treeview. I believe the type is called "TreePath". Anyway...I'm currently creating a winform application and would like to re-create this Area dropdown.
For example purposes, when creating a bug in VSTS, the Area field looks like this: Vince Test Project -item 1 -item 2 -item 3
So far I've manage to do the following inside my winform application:
NOTE: _store.Projects[9]...project 9 is the ID of the project I'm interested in. Its hardcoded for now
Begin form_load --------------------------------------------------------------------------- _store = (WorkItemStore)_currentTFS.GetService(typeof(WorkItemStore)); WorkItemTypeCollection workItemTypes = _store.Projects[9].WorkItemTypes; WorkItemType wit = workItemTypes["Sprint Backlog Item"]; WorkItem wi = new WorkItem(wit);
//Fill in the Area combobox //GetArea(wi);
//Fin in the Build combobox GetBuilds(wi);
//Fill in the Severity combobox GetSeverities(wi); --------------------------------------------------------------------------- End form_load
I have 3 combobox on my winform. One for replicating the Area field, another one for the Builds and one for the Severity.
The GetBuilds(wi) and GetSeverities(wi) procedure has the following code:
private void GetSeverities(WorkItem wrkitem) { //Load Severity combobox foreach (string val in wrkitem.Fields["Conchango.VSTS.Scrum.Severity"].AllowedValues) { _cboSeverity.Items.Add(val); } //Default Severity combobox to first item _cboSeverity.SelectedIndex = 0; }
NOTE: The procedure for the GetBuilds() is the same except the .Fields[""] is not the same.
My question is the following, how can I programatically create the exact same dropdown field as the Area field? When I debug the application and look at the CoreField.AreaPath, it returns the top level string Vince Test Project.
But what about the sub-items? -item 1, -item 2, -item 3
When trying: wi.Fields[CoreField.AreaPath].AllowedValues.Count it returned "0" Why? I know I should be having a list because opening a bug and clicking the Area dropdown gives me: Vince Test Project -item 1 -item 2 -item 3
If anyone could help me figure out how to re-create the Area dropdown with all its sub-items that would be great! perhaps a link, example! anything! Thanks in advance Sincerely
Vince
|