Paulo,
If you just need to show a checkbox to edit a value, you could use a CheckBox style and then use a DataFilter to commit the values as a string type. There is actually a KB article for doing exactly this:
HOWTO:Use a WinGrid DataFilter to convert strings to bools (and vice-versa) for a checkbox column
-Matt
Matt,
First, thanks for your response.
It looks like it's not possible to set the CheckBox style for the column that has its DataType property set to other than bool type (DataCell - in my case). Am I missing something?
I tried to solve the issue from the opposite perspective: I made DataCell to be IConvertible and set the DataType of the column to be bool. But in order to complete cell value committing I have to set the DataCell.Value property with the new value. But the DataCell is not longer associated with the UltraGridCell that is being committed (the UltraGridCell.Value property value is pure bool).
Any help?
Thanks,
Paulo
Hi Paulo,
If you use the code from the KB article which uses a DataFilter and assigns an editor to the cell, then you don't need to set the Style property on the column and it will give you the behavior you need.
You will need to change a few things from the sample code, of course, since it uses strings. If the sample is setting the ExpectedType property anywhere, make sure you set it to the correct DataType of the column instead of string.
You should write your own DataFilter and call this code:
CheckEditor editor = new CheckEditor();
editor.DataFilter = myFilter;
column.Editor = editor;
- Vitaly