Welcome to the Xceed Community | Help
Community Search  

Cannot disable control in CheckBox/ViewerEditor

Sort Posts: Previous Next
  •  11-20-2008, 10:40 AM Post no. 17059

    Cannot disable control in CheckBox/ViewerEditor

    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

  •  11-20-2008, 4:30 PM Post no. 17069 in reply to 17059

    Re: Cannot disable control in CheckBox/ViewerEditor

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


    André
    Software Developer and Tech Support
    Xceed Software Inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.