Walkthrough: Adding Custom XAML to the Start Page

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Walkthrough: Adding Custom XAML to the Start Page.

This walkthrough shows how to create a custom Visual Studio Start Page that contains a Web browser.

  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="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>  
    
    
  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 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.

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 Gallery Web site, or to another Web site or network share. For more information, see Deploying Custom Start Pages.

Customizing the Start Page
WPF Container Controls

Show: