MS Ribbon - Recent Documents List

Oct 14, 2010 at 10:15 PM

I'm looking at different parts of the Word example for the new MS Ribbon control.  I'm trying to get the recent documents section working.  The example doesn't even show how to capture a user clicking on an item.  Has anyone modified this to get it working properly?

Oct 16, 2010 at 12:30 AM
Edited Oct 16, 2010 at 12:33 AM

Right now I don't know if the Ribbon supports a better way that subscribing to the ItemsControl that is contained in the example.

I did this modification to the exampled based on this question

Look at the event MouseLeftButtonDown


    <r:RibbonApplicationMenu Label="Title">
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="5" />
                    <RowDefinition Height="*" />
                <r:RibbonSeparator Grid.Row="0" Label="Recent Xs" />
                    <ItemsControl Grid.Row="2" ItemsSource="{Binding RecentFiles}">
                                <Border x:Name="MainBorder" 
                                    <Grid MouseLeftButtonDown="RecentFile_MouseLeftButtonDown">

And the handler:
        private void RecentFile_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            RecentFile file = (RecentFile)((FrameworkElement)e.Source).DataContext;

I prefer using a method only using xaml and passing the Command with a Binding expression, but I still don't know how to do it.
And I would like to handle that the user presses the key '1' and so on, and open the corresponding file.
Oct 18, 2010 at 3:09 PM

Thanks, that works well.  Unfortunately, the keyboard input is still lacking compared to the Office ribbon.