title: Enable button when checkbox is checked in WPF datagrid
body: <p>I have a <code>Datagrid</code> in WPF in which <code>first column</code> has <code>checkbox</code> column and <code>last column</code> has <code>buttons</code>.
  Initially, I want to make all the buttons disabled and whenever any <code>checkbox</code> is checked then button of that row should get enabled. 
  <code>checkbox</code> is <code>unchecked</code> then button should be disabled.</p>
  
  <p>Searched a Lot but could not find anything related to this.</p>
  
  <p>I am not using MVVM.. How to do this on the code behind?</p>
  
  <p>Thanks</p>
  
  <p><strong>This is my Xaml Code and I am simply assigning my itemsource on the code behind</strong></p>
  
  <pre><code>            &lt;Grid Grid.Row="2" Grid.ColumnSpan="2" Margin="5" VerticalAlignment="Top" HorizontalAlignment="Center" &gt;
              &lt;Border BorderThickness="0" Margin="10" CornerRadius="15"&gt;
                  &lt;Border.BitmapEffect&gt;
                      &lt;DropShadowBitmapEffect /&gt;
                  &lt;/Border.BitmapEffect&gt;
                  &lt;Grid&gt;
                      &lt;Border x:Name="BDRounded" BorderThickness="0" CornerRadius="15" Background="White"/&gt;
                      &lt;DataGrid HorizontalAlignment="Left" x:Name="dgrdActors" RowHeight="74" AutoGenerateColumns="False" CanUserAddRows="False"
                                        BorderThickness="1,0,0,0" BorderBrush="#FFD1A251" FontSize="28" Foreground="#DCA566" FontFamily="Helvetica Neue" 
                                        CanUserResizeRows="False" AlternatingRowBackground="Linen" AlternationCount="2" Background="#DCA566"
                                        RowHeaderWidth="0" CanUserResizeColumns="False" CanUserSortColumns="False" CanUserReorderColumns="False"
                                        ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Visible" 
                                        HorizontalGridLinesBrush="#FFD1A251" VerticalGridLinesBrush="#FFD1A251" Height="326"
                                        SelectionMode="Extended" SelectionUnit="FullRow" VirtualizingStackPanel.VirtualizationMode="Standard"
                                        Style="{StaticResource DatagridStyle}"&gt;
                          &lt;DataGrid.Columns&gt;
                              &lt;DataGridTemplateColumn Width="70" CanUserReorder="False" CanUserResize="False" CanUserSort="False" CellStyle="{StaticResource                      HitVisibilityCellStyle}" HeaderStyle="{StaticResource HeaderStyle}" &gt;
                                  &lt;DataGridTemplateColumn.CellTemplate&gt;
                                      &lt;DataTemplate&gt;
                                          &lt;Viewbox Margin="-1"&gt;
                                              &lt;!--&lt;CheckBox x:Name="chkboxactors" HorizontalAlignment="Center" VerticalAlignment="Center" 
                                                        IsChecked="{Binding IsActorChecked, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/CheckBox&gt;--&gt;
                                              &lt;CheckBox x:Name="chkboxActors" HorizontalAlignment="Center" VerticalAlignment="Center"&gt;&lt;/CheckBox&gt;
                                          &lt;/Viewbox&gt;
                                      &lt;/DataTemplate&gt;
                                  &lt;/DataGridTemplateColumn.CellTemplate&gt;
                              &lt;/DataGridTemplateColumn&gt;
                              &lt;DataGridTextColumn Header="Actor Name(s)" Width="300" Binding="{Binding ActorName}" CanUserReorder="False" CellStyle="{StaticResource                              CellStyle}" CanUserResize="False" CanUserSort="False" HeaderStyle="{StaticResource HeaderStyle}"                            IsReadOnly="True"&gt;
                                  &lt;DataGridTextColumn.ElementStyle&gt;
                                      &lt;Style TargetType="TextBlock"&gt;
                                          &lt;Setter Property="TextWrapping" Value="Wrap"/&gt;
                                          &lt;Setter Property="HorizontalAlignment" Value="Center"&gt;&lt;/Setter&gt;
                                          &lt;Setter Property="VerticalAlignment" Value="Center"&gt;&lt;/Setter&gt;
                                      &lt;/Style&gt;
                                  &lt;/DataGridTextColumn.ElementStyle&gt;
                              &lt;/DataGridTextColumn&gt;
                              &lt;DataGridTextColumn Header="Role(s)" Width="300" Binding="{Binding Role}" CanUserReorder="False" CellStyle="{StaticResource CellStyle}"                     CanUserResize="False" CanUserSort="False" HeaderStyle="{StaticResource HeaderStyle}" IsReadOnly="True"&gt;
                                  &lt;DataGridTextColumn.ElementStyle&gt;
                                      &lt;Style TargetType="TextBlock"&gt;
                                          &lt;Setter Property="TextWrapping" Value="Wrap"/&gt;
                                          &lt;Setter Property="HorizontalAlignment" Value="Center"&gt;&lt;/Setter&gt;
                                          &lt;Setter Property="VerticalAlignment" Value="Center"&gt;&lt;/Setter&gt;
                                      &lt;/Style&gt;
                                  &lt;/DataGridTextColumn.ElementStyle&gt;
                              &lt;/DataGridTextColumn&gt;
                              &lt;DataGridTemplateColumn Width="250" CanUserReorder="False" CanUserResize="False" HeaderStyle="{StaticResource HeaderStyle}"                         CellStyle="{StaticResource HitVisibilityCellStyle}"&gt;
                                  &lt;DataGridTemplateColumn.CellTemplate&gt;
                                      &lt;DataTemplate&gt;
                                          &lt;Button x:Name="btnSelectRole" Content="Select Role" Style="{StaticResource DatagridButtonStyle}"&gt;&lt;/Button&gt;
                                      &lt;/DataTemplate&gt;
                                  &lt;/DataGridTemplateColumn.CellTemplate&gt;
                              &lt;/DataGridTemplateColumn&gt;
                          &lt;/DataGrid.Columns&gt;
  
                          &lt;DataGrid.OpacityMask&gt;
                              &lt;VisualBrush Visual="{Binding ElementName=BDRounded}"/&gt;
                          &lt;/DataGrid.OpacityMask&gt;
                      &lt;/DataGrid&gt;
                  &lt;/Grid&gt;
              &lt;/Border&gt;
          &lt;/Grid&gt;
  </code></pre>