Not allow null in DataGrid bool DataColumn

G

Guest

Hi

I have created a DataColumn and added it to a DataGrid

DataColumn cCat = new DataColumn(cat.Name, typeof(bool))

In the DataGrid it is possible to edit the bool value to true, false or null
Is there a way to not allow the null value (shown as not enabled checkbox) when editing

Best regards, Eric
 
T

Tim Wilson

If I remember correctly, you can set the AllowDBNull property on the proper
DataColumn to false and that should do the trick.
 
T

Tim Wilson

Actually, I think to achieve exactly what you want you will need to create a
custom DataGridTableStyle, and add to it a DataGridBoolColumn with the
AllowNull property set to false. This DataGridBoolColumn should correspond
to the DataColumn represented in your code by "cat.Name".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top