Reputation: 15934
I have a DataGridView
that I'm binding a list to:
var list = GetOrderedPlayListItems(playList.Items.Where(f => f != null).ToList());
gvPlayListItems.AutoGenerateColumns = false;
gvPlayListItems.DataSource = list;
Console.WriteLine(gvPlayListItems[3, 0].ReadOnly); //Displays TRUE
The problem I have is that my CheckBox column (column 4) is readonly. Things I've checked:
playList.Items
and the class behind that item has public bool FullScreen {get;set;}
so nothing private and my DataPropertyName
is FullScreen.I've tried setting it to not readonly in bindcomplete but that didn't help.
Any ideas as I'm a little stumped and currently, can't click the checkbox.
Upvotes: 0
Views: 1153
Reputation: 15934
I've found the issue for this. The column wasn't read only, the grid wasn't read only but after looking at my Designer.cs
file and looking for ReadOnly = true
I saw the DataGridView.RowTemplate.ReadOnly
flag was set to true ...
I mean, how many read only's do we need :)
Anyway, that sorted it.
Upvotes: 0
Reputation: 562
what about gvPlayListItems[2, 0].ReadOnly? you mention the 3rd column but [3, 0] is the 4th column. Just a first glance look at the issue
Upvotes: 1