title: How to disable a cell in a DataGrid while binding to an ObservableCollection
body: <p>In my program I have a UserControl that contains a <code>DataGrid</code> that has it's <code>ItemsSource</code> bound to an <code>ObservableCollection</code>. For that <code>DataGrid</code> I need to be able to disable and gray out specific cells. I would like to do this preferably in c++, because I might need to change which cells this happens to at run time. I know how to use <code>IsReadOnly</code>, but it appears that I can only toggle that for an entire column. This becomes a problem because my columns are bound to data, which makes it harder for me to target specific grid cells.</p>
  
  <p>With that being said,</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;DataGrid ItemsSource="{Binding Model.Collection}" ... &gt;
      &lt;DataGrid.Columns&gt;
            &lt;!-- Row Number --&gt;
            &lt;DataGridTextColumn Width="SizeToCells" IsReadOnly="True" Binding="{Binding rowNum}" /&gt;
            &lt;!-- Inputs --&gt;
            &lt;DataGridTextColumn Width="SizeToCells" IsReadOnly="False" Header="Inputs" Binding="{Binding input}" /&gt;
            &lt;!-- Outputs --&gt;
            &lt;DataGridTextColumn Width="SizeToCells" IsReadOnly="False" Header="Outputs" Binding="{Binding output}" /&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>Data Model:</p>
  
  <pre><code>namespace Program.Data_Models
  {
      public class CartIO_Model : PropertyChangedBase
      {
          private string test1 = "One";
          private string test2 = "Two";
          private string test3 = "Three";
          private string DISABLEDtest4 = "Four";
          private string DISABLEDtest5 = "Five";
  
          private ObservableCollection&lt;collectionData&gt; _collection; 
  
          public CartIO_Model()
          {
              Collection = new ObservableCollection&lt;collectionData&gt;();
              Collection.Add(new collectionData() { rowNum = 0, input = test1, output = ""});
              Collection.Add(new collectionData() { rowNum = 1, input = test2, output = ""});
              Collection.Add(new collectionData() { rowNum = 2, input = "", output = test3 });
              Collection.Add(new collectionData() { rowNum = 3, input = "", output = DISABLEDtest4 });
              Collection.Add(new collectionData() { rowNum = 4, input = DISABLEDtest5, output = ""});
  
          }
  
          public ObservableCollection&lt;collectionData&gt; Collection
          {...}
      }
  
      public class collectionData
      {
          public int rowNum { set; get; }
          public string input { set; get; }
          public string output { set; get; }
      }
  }
  </code></pre>
  
  <p>Where and how would I control which cells are enabled/disabled? This confuses me because <code>IsEnabled</code> is a trait of a View control, not that of an <code>ObservableCollection</code>.</p>