title: Unhandled exception when adding a RibbonGroup
body: <p>I am trying to implement the Outlook Ribbon in a WPF application, and the ribbon works fine.  However when I try to add a RibbonGroup, I get an unhandled exception in the XAML.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;r:RibbonWindow 
      x:Class="WpfArticles.Main"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
      Title="Main" Height="500" Width="500"&gt;
  
      &lt;StackPanel&gt;
          &lt;r:Ribbon Title="WPF Ribbon - Document1" x:Name="ribbon" &gt;
              &lt;r:RibbonTab Label="Home"&gt;
                  &lt;r:RibbonGroup Name="Test" /&gt;
              &lt;/r:RibbonTab&gt;
              &lt;r:RibbonTab Label="Insert"/&gt;
              &lt;r:RibbonTab Label="Help"/&gt;
          &lt;/r:Ribbon &gt;
  </code></pre>
  
  <p>and I am getting this error in the XAML :</p>
  
  <pre><code>Object reference not set to an instance of an object. at
  Microsoft.Windows.Controls.Ribbon.RibbonGroup.OnApplyTemplate() at
  System.Windows.FrameworkElement.ApplyTemplate() at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.StackPanel.MeasureOverride(Size constraint) at
  Microsoft.Windows.Controls.Ribbon.RibbonGroupsContainer.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at
  System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at
  System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at
  System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Border.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at
  System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Control.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at
  System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at
  System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Control.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.StackPanel.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at
  System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Decorator.MeasureOverride(Size constraint) at
  System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at
  System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at
  System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Border.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Border.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.DockPanel.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Border.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Control.MeasureOverride(Size constraint) at
  MS.Internal.WindowControl.DesignTimeWindow.MeasureOverride(Size availableSize) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  MS.Internal.Designer.SimpleViewManager.DesignerBackground.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Decorator.MeasureOverride(Size constraint) at
  Microsoft.Windows.Design.Interaction.DesignerView.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  MS.Internal.Designer.Viewport.MeasureOverride(Size availableSize) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at
  System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at
  System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at
  System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Grid.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at
  System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Controls.Control.MeasureOverride(Size constraint) at
  System.Windows.FrameworkElement.MeasureCore(Size availableSize) at
  System.Windows.UIElement.Measure(Size availableSize) at
  System.Windows.Interop.HwndSource.SetLayoutSize() at
  System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value) at
  System.Windows.Interop.HwndSource.set_RootVisual(Visual value) at
  MS.Internal.Designer.VSIsolatedDesigner.ViewHolder.Initialize() at
  MS.Internal.Designer.VSIsolatedDesigner.ViewHolder..ctor(UIElement content) at
  MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.get_ViewHandle() at
  MS.Internal.Host.Isolation.IsolatedView.get_ViewHandle() at
  MS.Internal.Designer.DesignerPane.LoadDesignerView()
  </code></pre>
  
  <p>What am I doing wrong? Without the <code>&lt;r:RibbonGroup Name="Test" /&gt;</code> it works fine!</p>
  
  <p>Thanks for your help and time</p>