2

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 problem Commented Nov 10, 2010 at 21:02

1 Answer 1

1

Does your binding need to be Mode=TwoWay?

Sign up to request clarification or add additional context in comments.

1 Comment

Nope. It's for display purposes only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.