Export (0) Print
Expand All

How to: Create a Top-Level Tab with a WPF Custom Control

Published: December 17, 2010

Updated: October 9, 2012

Applies To: Windows Home Server 2011, Windows Server 2012 Essentials, Windows Small Business Server 2011 Essentials, Windows Storage Server 2008 R2 Essentials

The Dashboard typically includes subtabs that contain a list pane, details pane, and task pane. You can choose to replace these panes with a Windows Presentation Foundation (WPF) control.

You must create a class that inherits ControlRendererPage class to add a WPF control to your subtab.

To create a subtab with a custom control

  1. Ensure that you have finished the procedure listed in Create a Top-Level Tab, and ensure that you used the HSBSTopLevelTabWPF template to create the tab.

  2. In the SubTab project, open the SubTabPage.cs file.

  3. You must provide identifying information for the page. Change the subtab name and description in the constructor of the class as well as the GUID passed to the base class’s constructor:

    public class SubTabPage : ControlRendererPage
       public SubTabPage()
          : base(new Guid([Insert new GUID here.]), 
          "SubTab Sample", 
          "SubTab Sample Description")

    SubTab Sample is the name of your tab. SubTab Sample Description is the tool tip description for your tab that is displayed when the mouse hovers over the tab name.

    You must supply your own unique GUID. For more information about creating a GUID, see Create Guid (guidgen.exe) (http://go.microsoft.com/fwlink/?LinkId=116098).

  4. The CreateContent method uses the Create method of the ControlRendererPageContent class to initialize a ControlRendererPageContent object. The ControlRendererPageContent object is used by the Dashboard to display your custom control. In the following code sample, MyControlHost represents the custom Control that is displayed on the subtab:

    protected override ControlRendererPageContent CreateContent()
       return ControlRendererPageContent.Create(new MyControlHost());
  5. (Optional) You can provide help information for the page. The following code example shows how to override the CreateHelpTopicInfo method:

    protected override HelpTopicInfo CreateHelpTopicInfo()
       // Replace with a custom URL or CHM/HTML file path.
       return new HelpTopicInfo(new Uri("http://servername/help"));

    You can also refer to help information in a compiled help file.

    protected override HelpTopicInfo CreateHelpTopicInfo()
       HelpTopicInfo helpTopic = null;
       helpTopic = new HelpTopicInfo(@"<path to help .chm file>",
       return helpTopic;
  6. In the SubTab project, open the MyCustomControl\MyWPFControl.xaml. file. Add controls to define the user interface for the add-in.

  7. Save and build the solution.

© 2015 Microsoft