title: Use Application Resource as DataContext in XAML
body: <p>I am having trouble using an application resource for a DataContext in a separate XAML file for a window.  (The DataContext is an MVVM ViewModel.)  I have searched Google and SO, and it seems like what I am doing should be correct.
  Here is the App.xaml code:</p>
  
  <pre><code>&lt;Application x:Class="Test.App"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:ViewModel="clr-namespace:Test.ViewModel;assembly=Test.ViewModel"
               Startup="Application_Startup"&gt;
      &lt;Application.Resources&gt;
          &lt;ViewModel:DocumentManager x:Key="DocumentManagerViewModel" /&gt;
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p>Here is part of my MainWindow.xaml:</p>
  
  <pre><code>&lt;ribbon:Ribbon&gt;   
      &lt;ribbon:Ribbon.ApplicationMenu&gt;
          &lt;ribbon:RibbonApplicationMenu SmallImageSource="..\Images\SmallIcon.png"
                                        DataContext="{Binding Source={StaticResource DocumentManagerViewModel}}"&gt;
          &lt;/ribbon:RibbonApplicationMenu&gt;
      &lt;/ribbon:Ribbon.ApplicationMenu&gt;
  &lt;/ribbon:Ribbon&gt;
  </code></pre>
  
  <p>When I run this, I get the following a XamlParseException:</p>
  
  <p>'Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '31' and line position '47'.</p>
  
  <p>I have also tried:</p>
  
  <p>DataContext="{StaticResource DocumentManagerViewModel}"</p>