title: Change the order of Columns in a DataGrid
body: <p>I want to create something like reusable Control.</p>
  
  <p>I have added a Page called MyDataGrid.xaml to my Project(WPFApplication2)'s root directory. I have changed the root element from Page to DataGrid and added a column to it. you can see that changes in the xaml below:</p>
  
  <pre><code>&lt;DataGrid x:Class="WpfApplication2.MyDataGrid"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Height="300" Width="300"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTemplateColumn Header="Delete"&gt;
              &lt;DataGridTemplateColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;Button Content="X" /&gt;
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellTemplate&gt;
          &lt;/DataGridTemplateColumn&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>And in the MyDataGrid.xaml.cs I changed the base class to DataGrid. You can see that below:</p>
  
  <pre><code>public partial class MyDataGrid : DataGrid
  {
      public MyDataGrid()
      {
          InitializeComponent();
      }
  }
  </code></pre>
  
  <p>Now I have MainWindow.xaml provided by default. I added this reusable control to the MainWindow.xaml and added some Columns to it as you can see below:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication2.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:Self="clr-namespace:WpfApplication2"
          Title="MainWindow" Height="350" Width="525"&gt;
      &lt;Grid&gt;
          &lt;Self:MyDataGrid&gt;
              &lt;Self:MyDataGrid.Columns&gt;
                  &lt;DataGridTextColumn Header="Name" /&gt;
                  &lt;DataGridTextColumn Header="Age" /&gt;
                  &lt;DataGridTextColumn Header="Class" /&gt;
                  &lt;DataGridTextColumn Header="School" /&gt;
              &lt;/Self:MyDataGrid.Columns&gt;
          &lt;/Self:MyDataGrid&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p><strong>My Problem:</strong></p>
  
  <p>When i run the program the Columns are in order below:</p>
  
  <p>Delete Name Age Class School</p>
  
  <p>In above mentioned columns Delete Column is Provided by Default and other columns are declared in MainWindow.xmal</p>
  
  <p>Now, I want to change the order of columns so that the default column shows at the end of the DataGrid as below :</p>
  
  <p>Name Age Class School Delete </p>