2
votes

I'm trying to programmatically bind an IList to a datagrid and one of the columns is a boolean value, so I decided to use a DataGridCheckBoxColumn instead of my usual DataGridTextColumn. Unfortunately, this doesn't seem to be working.

This the code I am currently using:

DataGridCheckBoxColumn dgcbc = new DataGridCheckBoxColumn();
Binding b = new Binding("Convicted");

dgcbc.Header = "Convicted";
dgcbc.Binding = b;
this.dgResults.Columns.Add(dgcbc);

After I set the source for the DataGrid the checkbox column shows up, but they are all unchecked. If I switch the DGCBC back to a DGTC the binding correctly shows up as either "true" or "false". Any ideas?

1
The code you posted works just fine, just tried it. Something else must be the problemFredrik Hedblad

1 Answers

1
votes

Does your binding need to be Mode=TwoWay?