title: How to bind to IsReadOnly property of DataGridCheckBoxColumn in xaml?
body: <p>I am trying to bind to the <code>IsReadOnly</code> property but it doesn’t seem to work. How could I achieve this? What is wrong with my approach? Below is sample code replicating the issue.</p>
  
  <p><strong>Update:</strong>
  added the code behind file... I have a observable collection hanging as a property from the code behind, which is used as the data context. The problem is not when property changes, even when I bind it for the first time the checked property is binded correctly but IsReadonly isn't.</p>
  
  <pre><code>public class ModelClass:INotifyPropertyChanged
  {
      private bool m_IsReadOnly;
      public event PropertyChangedEventHandler PropertyChanged;
  
      public void OnPropertyChanged(string propName)
      {
          if(PropertyChanged != null)
          {
              PropertyChanged(this, new PropertyChangedEventArgs(propName));
  
          }
      }
      public bool IsReadOnly
      {
          get { return m_IsReadOnly; } 
          set
          {
              m_IsReadOnly = value;
              OnPropertyChanged("IsReadOnly");
          }
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;Window x:Class="TestWpfApp.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:TestWpfApp"
      mc:Ignorable="d"
      Title="MainWindow" Height="350" Width="525"
      DataContext="{Binding RelativeSource={RelativeSource Self}}" &gt;
  
  &lt;Grid&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="63*"/&gt;
          &lt;RowDefinition Height="17*"/&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;DataGrid x:Name="modelClassDataGrid"
                AutoGenerateColumns="False" 
                EnableRowVirtualization="True" 
                ItemsSource="{Binding Models}" 
                Grid.RowSpan="2" RowDetailsVisibilityMode="VisibleWhenSelected"&gt;
          &lt;DataGrid.Columns&gt;
              &lt;DataGridCheckBoxColumn x:Name="col1" 
                                      Binding="{Binding IsReadOnly}" 
                                      IsReadOnly="{Binding IsReadOnly}" //doesn't work
                                      Header="With Binding" 
                                      Width="SizeToHeader"/&gt;
              &lt;DataGridCheckBoxColumn x:Name="col2" 
                                      Binding="{Binding IsReadOnly}" 
                                      IsReadOnly="True"
                                      Header="Without Binding" 
                                      Width="SizeToHeader"/&gt;
          &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
      &lt;DataGrid x:Name="dataGrid" HorizontalAlignment="Left" Margin="324,163,0,0" VerticalAlignment="Top"/&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>  public partial class MainWindow : Window
  {
      private ObservableCollection&lt;ModelClass&gt; _models = new ObservableCollection&lt;ModelClass&gt;(new List&lt;ModelClass&gt;()
      {
          new ModelClass() {IsReadOnly = false},
          new ModelClass() {IsReadOnly = true},
          new ModelClass() {IsReadOnly = false},
      });
  
      public MainWindow()
      {
          InitializeComponent();
      }
  
      public ObservableCollection&lt;ModelClass&gt; Models
      {
          get { return _models; }
      }
  }
  </code></pre>