title: wpf datagridcheckboxcolumn: how to enable/disable checkboxes
body: <p>I have a <code>DataGrid</code> with <code>DataGridCheckBoxColumn</code>. The grid has a binding with a list of objects. I want that, if there are N checkboxes checked, the unchecked become disabled, but I don't know how to perform the disable.</p>
  
  <pre><code>&lt;DataGridCheckBoxColumn
      x:Name="IsFixedByBracketColumn"
      Header="Fissato con staffa"
      Binding="{Binding isFixedByBracket, UpdateSourceTrigger=PropertyChanged}"
      IsReadOnly="False"&gt;
      &lt;DataGridCheckBoxColumn.ElementStyle&gt;
          &lt;Style TargetType="CheckBox"&gt;
              &lt;Style.Triggers&gt;
                  &lt;MultiDataTrigger&gt;
                      &lt;MultiDataTrigger.Conditions&gt;
                          &lt;Condition
                              Binding="{Binding
                                  HasMaxNumberReached,
                                  RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
                              Value="true"/&gt;
                          &lt;Condition
                              Binding="{Binding
                                  IsChecked,
                                  RelativeSource={RelativeSource Self}}"
                              Value="false"/&gt;
                      &lt;/MultiDataTrigger.Conditions&gt;
                      &lt;Setter Property="IsEnabled" Value="False"/&gt;
                  &lt;/MultiDataTrigger&gt;
              &lt;/Style.Triggers&gt;
              &lt;EventSetter
                  Event="CheckBox.Checked"
                  Handler="DataGridCheckBoxColumn_Checked" /&gt;
          &lt;/Style&gt;
      &lt;/DataGridCheckBoxColumn.ElementStyle&gt;                                        
  &lt;/DataGridCheckBoxColumn&gt;
  </code></pre>
  
  <p>Code for the event:</p>
  
  <pre><code>private void DataGridCheckBoxColumn_Checked(object sender, RoutedEventArgs e)
  {
      CheckBox cb = (CheckBox)sender;
      if (cb.IsChecked == true)
      {
          this.numberOfCheckboxesChecked++;
      }
      else
      {
          this.numberOfCheckboxesChecked--;
      }
  
      if (this.numberOfCheckboxesChecked &gt;= maxNumOfPointsPerSide)
      {               
          this.HasMaxNumberReached = true;
      }
      else 
      {
          this.HasMaxNumberReached = false; 
      }              
  }
  
  public bool HasMaxNumberReached
  {
      get {
          return hasMaxNumberReached;
      }
      set { 
          hasMaxNumberReached = value; 
          RaisePropertyChanged("HasMaxNumberReached");
      }
  }
  </code></pre>