This is a migrated thread and some comments may be shown as answers.

get the value of checkboxcolumn in datagrid

1 Answer 17 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ahmed
Top achievements
Rank 1
Ahmed asked on 03 Jul 2016, 04:21 AM

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 

1 Answer, 1 is accepted

Sort by
0
Ahmed
Top achievements
Rank 1
answered on 03 Jul 2016, 05:06 AM

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'.
Tags
GridView
Asked by
Ahmed
Top achievements
Rank 1
Answers by
Ahmed
Top achievements
Rank 1
Share this question
or