Click here to Skip to main content
15,921,279 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ArrayList list = new ArrayList();
            for (int i = 0; i < 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];
What is the issue? Not clear.
mukesh mourya 1-Dec-14 7:43am    
i have data grid in my wpf application which are bind from sql database

datagrid also have chechbox as to select row .
mukesh mourya 1-Dec-14 13:41pm    
then problem is that how can i collect cell (id) of selected row in Array list
here my code is not worked

please help me...

1 solution

for (int i = 0; i < myGrid.Items.Count; i++)
           var item = myGrid.Items[i];
           var mycheckbox = myGrid.Columns[5].GetCellContent(item) as CheckBox;
             if ((bool)mycheckbox.IsChecked)
                    string ID = (myGrid.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900