Hi i want to add check box in datagrid view.i have writen test code but fails. What i am trying to do is Add a CheckBox in datagrid with the items i add into it with select all and select none option.
I donot know how to do it so i need some help.I am confused with a thing that if we add then dynamically how would we track which checkbox was checked or un checked.
I have current code
public partial class MainWindow : Window
{
List<checkedBoxIte> item = new List<checkedBoxIte>();
public MainWindow()
{
InitializeComponent();
for (int i = 0; i < 5; i++)
{
checkedBoxIte ite = new checkedBoxIte();
ite.sr = i.ToString();
ite.ch = new CheckBox();
item.Add(ite);
}
dataGrid1.ItemsSource = item
}
}
public class checkedBoxIte
{
public string sr {get;set;}
public CheckBox ch { get; set; }
}
but i know it is stupidest thing to add checkbox like this but it was just a try Above class contains two attributes later on it would have more but all will be strings