Home › Forums › WinForms controls › Xceed Grid for WinForms › C# Forcing a column to display checkbox
-
AuthorPosts
-
#13317 |
Hello, I was wondering how could I change a column to act like a true / false type to allow me to check / uncheck its rows.
Imported from legacy forums. Posted by EFileTahi-A (had 4948 views)
First, the datatype of the column should be <b>System.Boolean</b>.
Second, you should create an <b>Xceed.Grid.Editors.GridCheckBox</b> and use it as cellviewer and celleditor of the column, like this:<code>
Xceed.Grid.Editors.GridCheckBox checkbox = new Xceed.Grid.Editors.GridCheckBox();
Xceed.Grid.Column column = myGrid.Columns[“myBooleanColumn”];
column.CellViewer = checkbox;
column.CellEditor = checkbox;
</code>If you want to check/uncheck a checkbox with only a single click, you can set the <b>SingleClickEdit</b> property of the gridcontrol to true.
Imported from legacy forums. Posted by Tommy (had 349 views)
OMG! Thank u tommy! That works just perfect!
The XceedSoft Online support just kick some serious #@!Imported from legacy forums. Posted by EFileTahi-A (had 238 views)
If have to tell you, I’m not official XceedSoft Online support: I’m just a user of Xceed products.
Imported from legacy forums. Posted by Tommy (had 206 views)
Oh, well yes, dumb of me:
Tommy Carlier
Software Engineer at weblications bvba
http://www.weblications.beDid not pay attention to this info :).
Anyway, Tommy, when my colums go true / false style, the also become opaque, that is, they do not show my Xceed grids background :(. I hope there is a way to walk around this one…
Imported from legacy forums. Posted by EFileTahi-A (had 343 views)
Thank you Tommy for your efforts! We really appreciate it here at Xceed.
EFileTahi, can you send your complete question at support@xceedsoft.com, we will take a look at your issue ASAP.
Cheers !
-Matt
Imported from legacy forums. Posted by Matt (had 579 views)
Since the CellEditor and CellViewer are using the same code to paint, and the checkbox control does not support transparent background, it is why you are having opaque background.
You can have the checkbox to only take the place it need instead of all the cell space. You do that by setting the GridCheckBox.FitToCell property to False. That way the control will only take the space needed, and you will then see the background of the Cell (Grid). Just note that will also change the way the checkbox get checked. The user will now need to click exactly on the checkbox to check or uncheck (If FitToCell is set to False (Default), clicking anywhere on the cell check or uncheck the checkbox).
Imported from legacy forums. Posted by Francois (had 592 views)
Ahhh, very interesting and usefull info! tks francois!
Imported from legacy forums. Posted by EFileTahi-A (had 6139 views)
-
AuthorPosts
- You must be logged in to reply to this topic.