views:

112

answers:

1

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?

A: 

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.

Timores
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