title: Add a button outside of a grid- Wpf
body: <p>So I am completely stuck. All i am trying to do is add a button outside a grid.
  I am getting the error "The property 'Content' can only be set once.</p>
  
  <p>I am trying to make a minesweeper game, which ofcourse contains a grid. And additional features such as restarting.</p>
  
  <p>I have tried adding a stackpanel(and various other containers) around both the grid and the button ,then the content error goes away and i get a new error...
  "An unhandled exception of type 'System.ArgumentException' occurred in PresentationCore.dll</p>
  
  <p>Additional information: Must disconnect specified child from current parent Visual before attaching to new parent Visual."</p>
  
  <p>I just need to know which container to use to have a button and potentially other components above the grid.</p>
  
  <pre><code>&lt;Window x:Class="MineSweeper.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:MineSweeper"
      mc:Ignorable="d"
      Title="MineSweeper" Height="500" Width="525"&gt;
  
  
      &lt;Grid Name="oGrid" HorizontalAlignment="Left" Height="100" Margin="200,75,0,0" VerticalAlignment="Top" Width="100"  Background="Transparent" PreviewMouseLeftButtonDown="oGrid_PreviewMouseLeftButtonDown"
        PreviewMouseRightButtonDown="oGrid_PreviewMouseRightButtonDown"&gt;
      &lt;/Grid&gt;
  
  
      &lt;Button x:Name="button" Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Canvas.Left="200" Canvas.Top="10"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is what i tried with stackpanel</p>
  
  <pre><code>    &lt;StackPanel&gt;
      &lt;Grid Name="oGrid" HorizontalAlignment="Left" Height="100" Margin="200,75,0,0" VerticalAlignment="Top" Width="100"  Background="Transparent" PreviewMouseLeftButtonDown="oGrid_PreviewMouseLeftButtonDown"
        PreviewMouseRightButtonDown="oGrid_PreviewMouseRightButtonDown"&gt;
      &lt;/Grid&gt;
  
  
      &lt;Button x:Name="button" Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Canvas.Left="200" Canvas.Top="10"/&gt;
  &lt;/StackPanel&gt;
  </code></pre>