Partilhar via


Walkthrough: Adding Custom XAML to the Start Page

Note

This article applies to Visual Studio 2015. 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.

Adding Custom XAML

  1. Create a Start Page by following the instructions in Creating 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="https://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="https://www.bing.com" />  
            </TabItem>  
        </TabControl>  
    </Grid>  
    

Testing 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.

Applying the Custom Start Page

To test the custom Start Page

  1. 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

Customizing the Start Page
WPF Container Controls