title: WPF Data Grid View default Checkbox value get
body: <p>I am working on a WPF windows application and I  need a help to solve some problem in it.</p>
  
  <p>I have a data gridview; here is a XML:</p>
  
  <pre><code>&lt;DataGrid x:Name="MyDataGrid" Margin="0,55.333,8,209.692" Width="273.27"&gt;
   &lt;DataGrid.Columns&gt;
                  &lt;DataGridTextColumn Header="ID" IsReadOnly="True" Binding="{Binding ID}" Visibility="Hidden" /&gt;
                  &lt;DataGridTextColumn Header="CopID" IsReadOnly="True" Binding="{Binding CopID}" Visibility="Hidden"/&gt;
                  &lt;DataGridTextColumn Header="CgID" IsReadOnly="True" Binding="{Binding CgID}" Visibility="Hidden"/&gt;
                  &lt;DataGridTextColumn Header="Item Names" Width="190" IsReadOnly="True" Binding="{Binding ItemName}"/&gt;
                  &lt;DataGridCheckBoxColumn  Header="Select" CanUserReorder="False" /&gt;
              &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>I want to check <code>DataGridCheckBoxColumn CheckBox</code> is true or false in loop
  My hope is this to read a Column Value when user click on button; here is the code:</p>
  
  <pre><code>for (int i = 0; i &lt; MyDataGrid.Items.Count - 1; i++)
  {
      /*Some code here for Check CheckBox True or False*/
      for (int j = 0; j &lt; MyDataGrid.Columns.Count; j++)
      {      
        string Massage = (MyDataGrid.Items[j] as DataRowView).Row.ItemArray[3].ToString();
        MessageBox.Show( Massage);
       }
   }
  </code></pre>
  
  <p>I want to check <code>CheckBox</code> is true or false in the loop to get value of that row Columns where is <code>CheckBox</code> is checked I hope somebody can help me
  to compete my code which I have done give up. I want this code to work when user click on button because I have to save record with this loop in database where <code>CheckBox</code> is true in <code>MyDataGrid</code>. </p>
  
  <p>And I also want to select all check box of datagrid when I will check the <code>CheckBox</code> call Select All.
  I hope some buddy help me in it as soon as possible
  Thank You</p>