title: "Content of a ContentControl must be a single element." exception
body: <p>I'm new to WPF so this may be a stupid question but here it is.<br>
  I'm trying to create custom button using the XAML thing, so this is what I have:  </p>
  
  <pre><code>&lt;Button x:Class="Controls.ShinyButton"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
               mc:Ignorable="d" 
               d:DesignHeight="300" d:DesignWidth="300" Height="40" Width="150"&gt;
      &lt;Button.Resources&gt;
          &lt;ResourceDictionary Source=".\Resources.xaml" /&gt;
      &lt;/Button.Resources&gt;
  
      &lt;Border Background="{StaticResource BlueGradient}" CornerRadius="5"&gt;
          &lt;DockPanel&gt;
              &lt;Image x:Name="imgIcon" DockPanel.Dock="Left" Height="32" Margin="4"/&gt;
              &lt;TextBlock DockPanel.Dock="Right" Text ="Test" VerticalAlignment="Center" HorizontalAlignment="Left" Foreground="White" /&gt;
          &lt;/DockPanel&gt;
      &lt;/Border&gt;
  
      &lt;Button.Background&gt;
          &lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&gt;
              &lt;GradientStop Color="#FF02B6FF" Offset="0" /&gt;
              &lt;GradientStop Color="#FF0084F0" Offset="1" /&gt;
          &lt;/LinearGradientBrush&gt;
      &lt;/Button.Background&gt;
   &lt;/Button&gt;
  </code></pre>
  
  <p>The designer understands it and it compiles without errors, but when I try to run the program and create an instance of it, I get the error:<br>
  "Content of a ContentControl must be a single element."  </p>
  
  <p>My resources file is:  </p>
  
  <pre><code>&lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  
      &lt;LinearGradientBrush x:Key="BlueGradient"&gt;
          &lt;GradientStop Offset="0" Color="#FF02B6FF"/&gt;
          &lt;!-- (2, 182, 255)--&gt;
          &lt;GradientStop Offset="1" Color="#FF0084F0"/&gt;
          &lt;!-- (0, 132, 240) --&gt;
      &lt;/LinearGradientBrush&gt;
  
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>I have the DockPanel inside my Border so the button has only one child...<br>
  The "ShinyButton" class looks like this:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Data;
  using System.Windows.Documents;
  using System.Windows.Input;
  using System.Windows.Media;
  using System.Windows.Media.Imaging;
  using System.Windows.Navigation;
  using System.Windows.Shapes;
  
  namespace Controls
  {
      /// &lt;summary&gt;
      /// Interaction logic for ShinyButton.xaml
      /// &lt;/summary&gt;
      public partial class ShinyButton : Button
      {
          public ShinyButton()
          {
              InitializeComponent();
          }
      }
  }
  </code></pre>
  
  <p>In the main function I add it like this:  </p>
  
  <pre><code>public MainWindow()
          {
              InitializeComponent();
  
              ShinyButton shiny = new ShinyButton();
              this.AddChild(shiny); //This is where the exception is thrown.
  
          }
  </code></pre>
  
  <p>What am I doing wrong?</p>