title: C# wpf proper way to bind DisplayIndex property of datagrid column
body: <p>I have bound the displayindex of my column to an integer variable (DisplayIndex_Name) in my datacontext.</p>
  
  <p><strong>XAML code:</strong></p>
  
  <pre><code>&lt;DataGridTextColumn Header="Name" DisplayIndex="{Binding Path=DisplayIndex_Name}" /&gt;
  </code></pre>
  
  <p>The column position in my datagrid is now equal to the value stored in DisplayIndex_Name. </p>
  
  <p>(If I set this to 0, this will show up as my first column)</p>
  
  <p>The problem is when I have multiple columns, If I change the displayIndex of 1 of them, all other displayindexes get updated since every column must have a unique value.</p>
  
  <p>This now means that the displayindex != the integer value to which it should be bound..</p>
  
  <p><strong>Any idea how I can update my variables in my datacontext to the exact value of the displayindex?</strong></p>