次の方法で共有


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.

Adding Custom XAML

To add custom XAML

  1. Create a Start Page by using the Start Page project template. For more information, see Start Pages.

  2. In Solution Explorer, open the .xaml file.

  3. In the XAML pane, scroll to the section that has this comment: <!—Center Content-->.

    The section contains a <TabControl> element inside a <Grid> element.

  4. Add a new <TabItem> element to the top of the <TabControl> element, as shown in the following example.

    <TabItem Header="Bing" Height="Auto">
        <Frame Source="https://www.bing.com" />
    </TabItem>
    
  5. Save the solution and close it.

Testing the Custom Start Page

To 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, on the Tools menu, click Options.

  3. In the Options dialog box, under Environment, select Startup. Then, 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.

  6. Perform a web search.

  7. Close the experimental instance.

Applying the Custom Start Page

To test the custom Start Page

  1. On the Tools menu, click Options.

  2. In the Options dialog box, under Environment, select Startup. Then, 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. You can create custom Start Pages that have other functionality by using the code-behind model to add a custom .dll, as shown in Walkthrough: Adding a DLL Reference 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.

See Also

Reference

System.Windows.Controls

Other Resources

Custom Start Pages

WPF Container Controls