Share via


Walkthrough: Add custom XAML to the start page

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

This walkthrough shows how to create a custom Visual Studio start page that contains a Web browser.

Add custom XAML

  1. Create a start page by following the instructions in Create a custom start page.

  2. In the MainWindow.xaml file, find the <Grid> section.

  3. Add a <TabControl> element and a <TabItem> inside the < Grid> element, as shown in the following example.

    <Grid>
        <TabControl>
            <TabItem Header="Bing" Height="Auto">
                <Frame Source="http://www.bing.com" />
            </TabItem>
        </TabControl>
    </Grid>
    
  4. Add a second <TabItem>, with a <Button> element that opens a new project:

    <Grid>
        <TabControl>
            <TabItem Header="MyButton" Height="Auto">
                <Button Name="btnNewProj" Content="New Project"
                    Command="{x:Static vscom:VSCommands.ExecuteCommand}"
                    CommandParameter="File.NewProject" >
                </Button>
            </TabItem>
            <TabItem Header="Bing" Height="Auto">
                <Frame Source="http://www.bing.com" />
            </TabItem>
        </TabControl>
    </Grid>
    

Test the custom start page

  1. Press F5.

    The experimental instance of Visual Studio opens, with the custom start page installed but not selected.

  2. In the experimental instance of Visual Studio, open the Tools /Options / Environment page.

  3. Select Startup. On the Customize Start Page list, select your .xaml file, and click OK.

  4. On the View menu, click Start Page.

  5. Click the Bing tab.

    You should see a Bing web page.

  6. Click the MyButton tab.

    You should see a MyProject button, which opens the New Project dialog.

  7. Close the experimental instance.

To apply the custom start page, in Tools > Options > Environment, select Startup. On the Customize Start Page list, select your .xaml file, and click OK.

Next steps

The Visual Studio start page now contains a tab that displays a Web browser tab and a MyButton tab. You can create custom start pages that have other functionality by using the code-behind model to add a custom .dll, as shown in Adding User Control to the Start Page. You can share custom start pages with other users by publishing the resulting .vsix file to the Visual Studio Marketplace Web site, or to another Web site or network share. For more information, see Deploying Custom Start Pages.

See also