loop through checkboxcolumn in datagrid in wpf checked or not

2 posts, 0 answers
  1. Ahmed
    Ahmed avatar
    4 posts
    Member since:
    Jul 2016

    Posted 04 Jul Link to this post

    i want to get the value of CheckBoxColumn in DataGrid wpf
    i try this code

     

    foreach (spShowTotal_Result item in dgShowStudent.ItemsSource)
            {
     
                bool? check = ((CheckBox)dgShowStudent.Columns[0].GetCellContent(item)).IsChecked;
     
            }

    but this exception appear
    Unable to cast object of type 'System.Windows.Controls.ContentPresenter' to type 'System.Windows.Controls.CheckBox'.
  2. Ahmed
    Ahmed avatar
    4 posts
    Member since:
    Jul 2016

    Posted 04 Jul Link to this post

    solution is here

    http://stackoverflow.com/questions/38177490/loop-through-checkboxcolumn-in-datagrid-in-wpf-checked-or-not

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top