Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / Checkbox not checking when selecting in a grid

Checkbox not checking when selecting in a grid

New Discussion
kodie wody
kodie wody asked on Apr 24, 2018 5:00 PM

I have a grid with read only columns and one checkbox column.

I set the grids CellClickAction: grid.DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect

because I have a click event handler on the grid to process the selected row.

The issue is when I check the checkbox, the check never makes it through.

My workaround is as follows:

private void grid_MouseClick(object         sender,
MouseEventArgs e)
{
var ug = (UltraGrid)sender;
if (ug.ActiveCell != null && ug.ActiveCell.Column.Key.Equals(“Check”))
{
ug.ActiveRow.Selected = true;
((CheckEditor) ug.ActiveCell.EditorResolved).CheckState = CheckState.Checked;
}
var selectedRows = grid.Selected;

if (selectedRows == null ||
selectedRows.Rows.Count == 0) return;

Service.RowClicked(selectedRows.Rows[0]
.ListObject as
IViewModel);

But as soon as you “select” the ActiveRow it clears the check box again.

Sign In to post a reply

Replies

  • 0
    Mike Bowshewicz
    Mike Bowshewicz answered on Apr 23, 2018 6:59 PM

    Hello,

    If I understand correctly, the intent of your workaround is to toggle the checkbox even though this doesn't normally happen in Row Select mode. Please try the below approach, which handles CellClick instead of MouseClick:

            private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
            {
                if (e.Cell.Column.DataType == typeof(bool))
                    e.Cell.Value = !(bool)e.Cell.Value;
            }
    

    Please let me know if this works for you.

    • 0
      kodie wody
      kodie wody answered on Apr 23, 2018 10:10 PM

      I should have clarified. I still need the mouse click event to be able to select the active row and process it. I tried the click cell event handler and the mouse click event logic clears out the check and doesnt seem to retain the selected active row.

      • 0
        Mike Bowshewicz
        Mike Bowshewicz answered on Apr 24, 2018 5:00 PM

        Hi Kodie,

        Using CellClick to handle the check box shouldn’t interfere with row selection, row activation, or the MouseClick event. I’ve put together a quick sample to show you how you might implement it in your application. Please try it out and let me know if it works for you.

        CheckboxRowSelect

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
kodie wody
Favorites
0
Replies
3
Created On
Apr 24, 2018
Last Post
8 years, 5 months ago

Suggested Discussions

Created by

Created on

Apr 24, 2018 5:00 PM

Last activity on

Feb 23, 2026 1:13 PM