category: [ Visual Studio ] tags: [ Getting Started ] [ Plugins ] [ Team Explorer ] [ Visual Studio ] [ Visual Studio Plugin ]
created: 16 Jan 2014 @ 17:59 modified: 24 Apr 2017 @ 13:57
In Getting start with a Team Explorer Plugin for VS 2013 Part 2 we created a Team Explorer Navigation Item and we will be using that item in this post and therefore assume that you have been through it already and created the navigation item.
Creating a Team Explorer Page
Add a new const to the GuidList class (in the Guids file) like below
Create a class called SampleTeamExplorerPage and replace the contents with code below
Note how we used the GuidList.sampleTeamExplorerPage guid string that we created in the TeamExplorerPage attribute. We also set some basic properties as in the previous post. Now that we have a page we will want to set the contents of the page
Creating Team Explorer Page Contents
Add a new user control to your project called SamplePageControl.xaml
We will not be adding anything fancy to this control, just add a TextBlock and set the Text property so that we are able to see that it is loaded, below is a sample of this
You will at this stage need to add a reference to the assembly System.Xaml.
Defining the Team Explorer Page Content
To define the Team Explorer Page Content all we need to do is change the PageContent property to return an instance of our SampleTeamExplorerPage class
This will now load our new user control each time this page is loaded.
Navigating to a Team Explorer Page
All that is required to navigate to a Team Explorer Page is the guid of that page. To enable the navigation in our sample go to the SampleTeamExplorerNavigationItem class and change the Execute method to look like below
You are also able to easily navigate to any other Page that is in Team Explorer if you know the guid, to make it easier to navigate to the default pages that are standards in TFS Microsoft has added a class called TeamExplorerPageIds which contains the Ids of all the default pages. For example if you wanted to navigate to the home page you would use the code below in your execute method or any other place
You'll notice now if you run the project that when you click on the sample button you are taken through to our new page and the page content is visible
That's all that was required to create a Team Explorer Page with Content .
In the Getting start with a Team Explorer Plugin for VS 2013 Part 4 we will be creating a new Team Explorer Section and then making some contents in the section content link through to this page.
Gordon Beeming works at Nologo Studios in the sunny city of Durban, South Africa. He is the Lead for the Data and Services Team and has a strong focus on Developer Efficiencies and R&D. When he's not hacking away at a keyboard in Visual Studio he'll generally be relaxing with his family or hitting the black top getting in some mileage. He is a Visual Studio ALM Ranger and Visual Studio ALM MVP.