title: Cannot find source for binding with reference with RibbonComboBox
body: <p>I'm trying to learn WPF and seem to be getting an error I really don't fully understand.</p>
  
  <pre><code>System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.Ribbon.RibbonWindow', AncestorLevel='1''. BindingExpression:Path=WindowState; DataItem=null; target element is 'Ribbon' (Name=''); target property is 'NoTarget' (type 'Object')
  System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.Ribbon.RibbonWindow', AncestorLevel='1''. BindingExpression:Path=IsActive; DataItem=null; target element is 'Ribbon' (Name=''); target property is 'NoTarget' (type 'Object')
  </code></pre>
  
  <p>Here a section of my XAML. I can't tell if the errors just started, but I have been tweaking code that works with the two <code>RibbonComboBoxe</code>es under the <em>Home</em> header. (The <code>&lt;Ribbon&gt;</code> element is in a <code>&lt;Grid&gt;</code> element.)</p>
  
  <p>Can anyone help me to try and resolve this issue? The code isn't quite behaving correctly and I can't tell if this error is related.</p>
  
  <pre><code>&lt;Ribbon&gt;
      &lt;Ribbon.ApplicationMenu&gt;
          &lt;RibbonApplicationMenu&gt;
              &lt;RibbonApplicationMenuItem Header="_Preview" ImageSource="Images/preview.png"&gt;&lt;/RibbonApplicationMenuItem&gt;
              &lt;RibbonSeparator&gt;&lt;/RibbonSeparator&gt;
              &lt;RibbonApplicationMenuItem Name="Save" KeyTip="S" Header="_Save" ImageSource="Images/save.png" ToolTipTitle="Save" ToolTipDescription="Save the current article and keep editing" Click="Save_Click"&gt;&lt;/RibbonApplicationMenuItem&gt;
              &lt;RibbonSeparator&gt;&lt;/RibbonSeparator&gt;
              &lt;RibbonApplicationMenuItem Name="SaveAndExit" KeyTip="X" Header="Save and E_xit" ToolTipTitle="Save and Exit" ToolTipDescription="Save the current article and close window" Click="SaveAndExit_Click"&gt;&lt;/RibbonApplicationMenuItem&gt;
              &lt;RibbonApplicationMenuItem Name="AbortAndExit" Header="_Abort Edit" ToolTipTitle="Abort Edit" ToolTipDescription="Close window without saving changes to this article" Click="AbortAndExit_Click"&gt;&lt;/RibbonApplicationMenuItem&gt;
          &lt;/RibbonApplicationMenu&gt;
      &lt;/Ribbon.ApplicationMenu&gt;
      &lt;RibbonTab Header="Home"&gt;
          &lt;RibbonGroup Header="Category"&gt;
              &lt;RibbonComboBox Label="Category:" SelectionBoxWidth="250"&gt;
                  &lt;RibbonGallery SelectedItem="{Binding Path=Categories.SelectedItem}"&gt;
                      &lt;RibbonGalleryCategory IsSharedColumnSizeScope="True" DisplayMemberPath="Text" ItemsSource="{Binding Path=Categories.Items}"&gt;
                      &lt;/RibbonGalleryCategory&gt;
                  &lt;/RibbonGallery&gt;
              &lt;/RibbonComboBox&gt;
              &lt;RibbonComboBox Label="Subcategory:" SelectionBoxWidth="250"&gt;
                  &lt;RibbonGallery SelectedItem="{Binding Path=Subcategories.SelectedItem}"&gt;
                      &lt;RibbonGalleryCategory IsSharedColumnSizeScope="True" ColumnsStretchToFill="True" MaxColumnCount="1" DisplayMemberPath="Text" ItemsSource="{Binding Path=Subcategories.Items}"&gt;
                      &lt;/RibbonGalleryCategory&gt;
                  &lt;/RibbonGallery&gt;
              &lt;/RibbonComboBox&gt;
              &lt;RibbonButton Label="Edit Categories" Command="local:EditCommands.Categories" SmallImageSource="Images\categories_sm.png" ToolTipTitle="Edit Categories" ToolTipDescription="Add, edit or delete categories and subcategories" ToolTipImageSource="Images\categories_sm.png"&gt;&lt;/RibbonButton&gt;
          &lt;/RibbonGroup&gt;
          &lt;RibbonGroup Header="Author"&gt;
              &lt;RibbonTwoLineText Text="jwood@softcircuits.com"&gt;&lt;/RibbonTwoLineText&gt;
              &lt;RibbonButton Label="Set Author" Command="local:EditCommands.Header1" SmallImageSource="Images\h1_sm.png" ToolTipTitle="Header 1" ToolTipDescription="Format selected text as a level 1 header" ToolTipImageSource="Images\h1.png"&gt;&lt;/RibbonButton&gt;
          &lt;/RibbonGroup&gt;
          &lt;RibbonGroup Header="Settings"&gt;
              &lt;RibbonCheckBox Name="chkApproved" Label="Approved"&gt;&lt;/RibbonCheckBox&gt;
              &lt;RibbonCheckBox Name="chkDeprecated" Label="Deprecated"&gt;&lt;/RibbonCheckBox&gt;
              &lt;RibbonButton Name="btnMetadata" Label="Metadata" SmallImageSource="Images\metadata_sm.png" ToolTipTitle="Metadata" ToolTipDescription="Edit article metadata" ToolTipImageSource="Images\metadata.png" Click="btnMetadata_Click"&gt;&lt;/RibbonButton&gt;
          &lt;/RibbonGroup&gt;
          &lt;RibbonGroup Header="History"&gt;
              &lt;RibbonButton Label="Edit Updates" Command="local:EditCommands.EditHistory" SmallImageSource="Images\history_sm.png" LargeImageSource="Images\history.png" ToolTipTitle="Edit Updates" ToolTipDescription="Edit update history for this article"&gt;&lt;/RibbonButton&gt;
          &lt;/RibbonGroup&gt;
      &lt;/RibbonTab&gt;
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Based on IlVic's answer, I changed my <code>Window</code> to a <code>RibbonWindow</code>. But then I'm getting the following error.</p>
  
  <pre><code>System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'RibbonGalleryItem' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')
  </code></pre>