Dela via


Visual Studio 2010 Get Started: Customize Start Page

imageHello, I am Hongye Sun from MSDN forum support team. Today, I will show you how to customize the start page in VS 2010. Two UI elements will be added into the start page:

  • A button which executes VS command and open MSDN forums link
  • A customized WPF user control which connects to Twitter

 

 

 

Enable Start Page Customization

image By default settings, VS 2010 uses file at %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\StartPages\en\StartPage.xaml

You can change the setting in options page: Environment –> Startup -> Customize Start Page –> Documents\Visual Studio 2010\StartPages\StartPage.xaml

 

 

Add a command button 

In the %UserProfile%\Documents\Visual Studio 2010\StartPages folder, open StartPage.csproj file in Visual Studio, and open StartPage.xaml file.

image

There are mainly three sections in the start page:

1. Command Buttons

2. Recent Projects

3. Center Content

To add a new button to command buttons section. Copy and paste the following XAML code:

   1: <vs:ImageButton
  2:     Grid.Row="6"
  3:     Grid.Column="0"
  4:     x:Uid="OpenForumButton"
  5:     Margin="15,2,0,2"
  6:     Width="Auto"        
  7:     Content="Open MSDN Forums..."
  8:     Style="{DynamicResource StartPage.ProjectCommand.ButtonStyle}"
  9:     Command="{x:Static vs:VSCommands.ExecuteCommand}" CommandParameter="View.WebBrowser https://social.msdn.microsoft.com/Forums"
 10:     ImageNormal="pack://application:,,,/Microsoft.VisualStudio.Shell.UI;component/Images/StartPage/OpenProject.png"
 11:     ImageHover="pack://application:,,,/Microsoft.VisualStudio.Shell.UI;component/Images/StartPage/OpenProjectMouseOver.png"
 12:     ImagePressed="pack://application:,,,/Microsoft.VisualStudio.Shell.UI;component/Images/StartPage/OpenProjectMouseDown.png">
 13: </vs:ImageButton>

The Command and CommandParameter shows it will execute View.WebBrowser command to navigate browser to MSDN forum site.

Add custom WPF Twitter user control

To save the time, I follow Rich’s blog to build a WPF twitter user control.

image

In order to add the control into xaml code into startpage.xaml file.

In file header:

   1: <Grid xmlns:my="clr-namespace:TwitterWPFControl;assembly=TwitterWPFControl"  
  2:       xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3:       xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
  4:       xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.UI"
  5:       mc:Ignorable="d" 
  6:       xmlns:d="https://schemas.microsoft.com/expression/blend/2008" 
  7:       xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="600" d:DesignWidth="800">

In the Center Content:

   1: <TabItem Header="Twitter">
  2:     <Grid >
  3:         <my:TwitterControl></my:TwitterControl>
  4:     </Grid>
  5: </TabItem>

Put the TwitterWPFControl assembly into %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\Components folder

StartPage&TwitterWPFControl.zip