get the value of checkboxcolumn in datagrid

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

    Posted 02 Jul Link to this post

    hiiii,, i want to get the value of checkboxcolumn in datagrid wpf

    i try this code

    if (item.boolCol == true)
                  {
                      MessageBox.Show("fail");
                  }
                  else
                  {
                      MessageBox.Show("success");
     
                  }

    but don't take the changed value but take the same value of the my itemsourse 

  2. Ahmed
    Ahmed avatar
    4 posts
    Member since:
    Jul 2016

    Posted 03 Jul in reply to Ahmed Link to this post


    i try this code  

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

    but this error is appear Unable to cast object of type 'System.Windows.Controls.ContentPresenter' to type 'System.Windows.Controls.CheckBox'.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top