Hello,
I have a UltraWinGrid where I want to display different features that can be bought in my application. For some of these features it is possible for the user to get a trial version. I want to represent this by having an unbound column in the grid with checkboxes. Checking it means that the user wants to try the feature, not checking it means that the user wants to wait with trying out the feature. In the cases where no trial is possible I don't want to display a checkbox at all. To many checkboxes clutters up my gui. And this is my question. Is it possible for me to add an unbound column to a UltraWinGrid where I display a checkable checkbox based upon a boolean in my datasource?
Regards, Johan
johancarlsson said:Is it possible for me to add an unbound column to a UltraWinGrid where I display a checkable checkbox based upon a boolean in my datasource?
Just one small issue.. then my checkbox free cells starts displaying "False" instead. What is really desired is completely empty cells. Do you have a good tip for an editor that can do this for me?
"False" is the string representation of a boolean value that is not true. You can use the IEditorDataFilter interface (see the editor's DataFilter property) to change the way a value is displayed and parsed by the editor, so you would have to implement that interface in order to make the value 'false' look like an empty string.
Thank you, this created the desired look. I'm curious, could this technique also be used for boolean columns that are databound? (I tried the same solution as for the unbound column, but without success).
Yes, this approach is independent of whether the column is bound...if you can be more specific about how you tried to get it to work and what the actual result was, we can try to help.
The following rows are placed within the InitializeRow method for the GridView:
e.Row.Cells["BuyTrial"].Editor = new Infragistics.Win.EditorWithText();e.Row.Cells["BuyTrial"].Editor.DataFilter = new EmptyBooleanDataFilter();e.Row.Cells["BuyTrial"].Activation = Activation.NoEdit;e.Row.Cells["PendingActive"].Editor = new Infragistics.Win.EditorWithText();e.Row.Cells["PendingActive"].Editor.DataFilter = new EmptyBooleanDataFilter();e.Row.Cells["PendingActive"].Activation = Activation.NoEdit;
It is the only code that relates to making a checkbox cell display nothing. "BuyTrial" is an unbound column, "PendingActive" is a bound column to a boolean. The result becomes as follows:
As you can see, the formatting works with disabled checkboxes for both columns, but my EmptyDataBooleanFilter (which returns string.Empty independent of indata) doesn't work for my databound column.