Home Forums WinForms controls Xceed Grid for WinForms Cannot disable control in CheckBox/ViewerEditor

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16642 |

    Hi,

    I have a grid that I am binding a list of objects to – the grid has two columns. One of the properties on my object is boolean, so the first column in the grid has:

    * newColumn.CellViewerManager = new CheckBoxViewer();

    * newColumn.CellEditorManager = new CheckBoxEditor();

    However, once the grid is bound, the user can make choices on the same UI that will affect the rows in the grid. By this, I mean that once the user has applied settings to other controls, I need to ‘disable’ certain rows in the grid. I can find the rows I want to disable easily enough. However, I am having trouble in making the CheckBoxControl (which I think must be a WinCheckBox) which is displayed in the cell to be disabled. I can make the row look disabled by setting the Cell’s Colours to DarkGray. But the user can still click in the CheckBox, and this still fires the Cell click event. I have tried to set the Cell.ReadOnly to true as well as the row.ReadOnly to true and nothing seems to help.

     I’m guessing that even if the control was disabled, that the cell’s click would still work. I probably ought to be binding to the WinCheckBox’s Checked event (if there is one) rather than the Cell’s Click event to capture when users are clicking and unclicking on the CheckBox. But even if I do this, it would not sort out my problem until I can disable the actual checkbox control created within the cell.

     If anyone has any advice they can offer me, I’d much appreciate it.

     Regards,

    Russell

    Imported from legacy forums. Posted by russellcoombes (had 693 views)

    User (Old forums)
    Member
    Post count: 23064

    Setting the cell or the row to ReadOnly should work.  However you can also change the default CheckBoxEditor/Viewer on the cell, and replace it by one that is disabled.

    e.g.:

    gridControl1.DataRows[ 0 ].Cells[

    “Discontinued” ].ReadOnly = true;

    //or

    gridControl1.DataRows[ 0 ].ReadOnly =

    true;

    //or

    WinCheckBox checkBox = new WinCheckBox();

    checkBox.Enabled =

    false;

    gridControl1.DataRows[ 0 ].Cells[

    “Discontinued” ].CellEditorManager = new CheckBoxEditor( checkBox );

    gridControl1.DataRows[ 0 ].Cells[

    “Discontinued” ].CellViewerManager = new CheckBoxViewer( checkBox );

    Imported from legacy forums. Posted by André (had 912 views)

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