2

I'd like to play around with customizing the visual studio 2010 rc start page recent items. For what I have in mind I'd need to customize the datasource / databinding but I can't find where the information is coming from.

<ScrollViewer Grid.Row="1" HorizontalAlignment="Stretch" 
    Style="{DynamicResource StartPage.ScrollViewerStyle}" 
    VerticalAlignment="Stretch"  VerticalScrollBarVisibility="Auto">
    <sp:MruListBox 
        DataContext="{Binding Path=RecentProjects}" 
        ItemsSource="{Binding Path=Items}"
        Background="Transparent"
        BorderThickness="0"
        AutomationProperties.AutomationId="MruList"/>
</ScrollViewer>

Can anyone point me in the right direction? I see that it is binding to RecentProjects but where is that coming from?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
devlife
  • 15,275
  • 27
  • 77
  • 131

1 Answers1

0

I could not find any real documentation about this. I guess you knew about VS Docs, but it doesn't even scratch the surface.

Since there is a RecentProjects property used in a binding, there should be a type exposing such a property (or an implementation of ICustomTypeDescriptor, see MSDN Magazine). There is also a binding on the TeamFoundationClientSupported "property".

I found a property called TeamFoundationClientSupported in Microsoft.VisualStudio.Shell.UI.Internal, in a class called Microsoft.VisualStudio.PlatformUI.StartPageDataSource, but it is private, so cannot be used as is in a binding. The constructor of this class contains quite a few lines like this:

base.AddBuiltInProperty(StartPageDataSourceSchema.CustomizationEnabledName, GetUserSetting(StartPageDataSourceSchema.CustomizationEnabledName, false));
    ...
base.AddBuiltInProperty(StartPageDataSourceSchema.TeamFoundationClientSupportedName, this.TeamFoundationClientSupported);
    ...
base.AddBuiltInProperty(StartPageDataSourceSchema.RecentProjectsDataSourceName, source3);
    ...

The last 2 are interesting: they "add a built-in property" called TeamFoundationClientSupported and RecentProjects...

Looking at the implementation at this method shows a simple dictionary with a key based on the property name (the first parameter) and the value being the second parameter. This dictionary is used by a method called EnumProperties in Microsoft.Internal.VisualStudio.PlatformUI.UIDataSource. Going through the chain of uses, we arrive at a class called Microsoft.Internal.VisualStudio.PlatformUI.DataSource (in Microsoft.VisualStudio.Shell.10.0), which implements ICustomTypeDescriptor. Thus, it explains how the properties are found by the binding system. I have not found how the DataSource type descriptor is linked to the StartPageDataSource class, but at least we can know the list of supported properties in the StartPageDataSource constructor.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Timores
  • 14,439
  • 3
  • 46
  • 46
  • Thanks John. I suppose this is about as good as it's gonna get for right now. Really I just wanted to extend the start page recent items to have the ability to rename the items (particularly the solutions). This would be useful for anyone who works in a mainline scm. At least I know I would get a ton of use out of it:) – devlife Mar 25 '10 at 01:54
  • I'm understand what the solution above is talking about, but I still don't understand how I can get a list of the properties that are available on the RecentProjectDataSource. Is there any way to access this is code? – Chris Nicol Jun 20 '11 at 06:19
  • I have not read them, but maybe these articles will help: http://www.7388.info/index.php/article/wpf/2011-06-17/18130.html and http://www.7388.info/index.php/article/wpf/2011-06-15/18024.html – Timores Jun 20 '11 at 20:21
  • The two links in the last comment are currently showing Chinese or some other Asian language pages. I think they are "404" error pages. – RenniePet Mar 05 '13 at 23:10
  • @RenniePet: thank you for pointing this out. I can't remember how I managed to insert bad links. What I meant were these 2 articles: http://blogs.msdn.com/b/visualstudio/archive/2010/07/29/walkthrough-creating-a-custom-start-page-part-1.aspx and http://blogs.msdn.com/b/visualstudio/archive/2010/07/29/walkthrough-creating-a-custom-start-page-part-2.aspx Sorry about that. – Timores Mar 06 '13 at 09:44