title: How can read checked row cell value in WPF DataGrid (Bind source from data context) using C#
body: <p>Here my DataGrid in wpfwin.xaml. I want to collect "Challan_No" value in list but i can't do this ..please help me </p>
  
  <p>
              </p>
  
  <pre><code>            &lt;DataGridTextColumn Header="Chalaan ID" Width="Auto" Binding="{Binding   Id, Mode=OneWay}"/&gt;
              &lt;DataGridTextColumn Header="Challan No" Width="Auto" Binding="{Binding Challan_No, Mode=OneWay}" IsReadOnly="True"/&gt;
              &lt;DataGridTextColumn Header="Company" Width="Auto" Binding="{Binding Organization_Name, Mode=OneWay}"/&gt;
              &lt;DataGridTextColumn Header="Client" Width="Auto" Binding="{Binding Organization, Mode=OneWay}"/&gt;
              &lt;DataGridTextColumn Header="Date" Width="Auto" Binding="{Binding Date, Mode=OneWay}"/&gt;
  
              &lt;DataGridTemplateColumn Header="select"  Width="100" &gt;
                  &lt;DataGridTemplateColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;CheckBox  x:Name="ckselect"  &gt;&lt;/CheckBox&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/DataGridTemplateColumn.CellTemplate&gt;
              &lt;/DataGridTemplateColumn&gt;
          &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
  </code></pre>
  
  <p>And  here, I tried some code to get it in .cs page</p>
  
  <pre><code>                    ArrayList list = new ArrayList();
                      for (int i = 0; i &lt; myGrid.Items.Count; i++)
                      {
                          CheckBox mycheckbox = myGrid.Columns[5].GetCellContent(myGrid.Items[i]) as CheckBox;
                          if (mycheckbox.IsChecked == true)
                          {
                              int inde = this.myGrid.SelectedIndex;
                              DataRowView drv = (DataRowView)myGrid.Items[inde];
                              object ch = drv[1];
                              list.Add(ch);
                          }
                      }
  </code></pre>