title: checkbox disabling and enabling in wpf
body: <p>IN my below code i have 2 check boxes chkQAReviewMandatory and chkIsAnsMandatory. My requirement is when i check the chkQAReviewMandatory  checkbox then automatically i need to checkbox chkIsAnsMandatory is checked and disabled, If chkQAReviewMandatory is not checked then uncheck the chkIsAnsMandatory and also enable it.</p>
  
  <pre><code>      &lt;StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Margin="5,15,5,0"&gt;
                          &lt;CheckBox x:Name="chkQAReviewMandatory" Content="QA Review Mandatory" Grid.Row="1" Grid.Column="0" Margin="0,5,0,0" 
                                    IsChecked="{Binding IsQAReviewMandatory}"/&gt;
                          &lt;StackPanel Orientation="Horizontal" Margin="20,0,0,0"&gt;
                          &lt;StackPanel.Style&gt;
                              &lt;Style TargetType="StackPanel"&gt;
                              &lt;Setter Property="Visibility" Value="Hidden"/&gt;
                              &lt;Style.Triggers&gt;
                                      &lt;DataTrigger Binding="{Binding ElementName=chkQAReviewMandatory, Path=IsChecked}" Value="True"&gt;
                                      &lt;Setter Property="Visibility" Value="Visible"/&gt;
                                  &lt;/DataTrigger&gt;
                              &lt;/Style.Triggers&gt;
                          &lt;/Style&gt;
                          &lt;/StackPanel.Style&gt;
                                  &lt;Label x:Name="lblMax" Content="QA Max Point" Height="20" VerticalAlignment="Center" Margin="0,5,5,0"&gt;&lt;/Label&gt;
                                  &lt;local:NumericTextBox Width="50"
                                                               MaxLength="1"
                                                               Height="25"
                                                               VerticalAlignment="Top"
                                                               Text="{Binding MaximumQAPoints}" /&gt;
                      &lt;/StackPanel&gt;
                      &lt;/StackPanel&gt;
  
                       &lt;CheckBox Content="Is Answer Mandatory" 
                            Grid.Row="2" 
                            HorizontalAlignment="Left" 
                            Margin="5,12,0,0" 
                            IsChecked="{Binding IsAnswerMandatory}" &gt;
                          &lt;CheckBox.Style&gt;
                              &lt;Style TargetType="CheckBox"&gt;
                                  &lt;Style.Triggers&gt;
                                      &lt;DataTrigger Binding="{Binding ElementName=chkQAReviewMandatory,Path=IsChecked}" Value="True"&gt;
                                          &lt;Setter Property="IsChecked" Value="True"/&gt;
                                          &lt;Setter Property="IsEnabled" Value="False"/&gt;
                                          &lt;Setter Property="Foreground" Value="White"/&gt;
                                      &lt;/DataTrigger&gt;
                                      &lt;DataTrigger Binding="{Binding ElementName=chkQAReviewMandatory,Path=IsChecked}" Value="False"&gt;
                                          &lt;Setter Property="IsChecked" Value="False"/&gt;
                                          &lt;Setter Property="IsEnabled" Value="True"/&gt;
                                          &lt;Setter Property="Foreground" Value="White"/&gt;
                                      &lt;/DataTrigger&gt;
                                  &lt;/Style.Triggers&gt;
                              &lt;/Style&gt;
                          &lt;/CheckBox.Style&gt;
                      &lt;/CheckBox&gt;
  </code></pre>