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

loop through checkboxcolumn in datagrid in wpf checked or not

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

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'.

1 Answer, 1 is accepted

Sort by
0
Ahmed
Top achievements
Rank 1
answered on 04 Jul 2016, 07:57 AM

solution is here

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

Tags
GridView
Asked by
Ahmed
Top achievements
Rank 1
Answers by
Ahmed
Top achievements
Rank 1
Share this question
or