Home Forums WinForms controls Xceed Grid for WinForms C# Forcing a column to display checkbox

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #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)

    User (Old forums)
    Member
    Post count: 23064

    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)

    User (Old forums)
    Member
    Post count: 23064

    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)

    User (Old forums)
    Member
    Post count: 23064

    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)

    User (Old forums)
    Member
    Post count: 23064

    Oh, well yes, dumb of me:

    Tommy Carlier
    Software Engineer at weblications bvba
    http://www.weblications.be

    Did 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)

    User (Old forums)
    Member
    Post count: 23064

    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)

    Xceed Support
    Member
    Post count: 5658

    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)

    User (Old forums)
    Member
    Post count: 23064

    Ahhh, very interesting and usefull info! tks francois!

    Imported from legacy forums. Posted by EFileTahi-A (had 6139 views)

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.