Home Forums WinForms controls Xceed Grid for WinForms CheckBox help Reply To: CheckBox help

User (Old forums)
Member
Post count: 23064

Had another think about this, solved it using the FirstVisibleColumnChanged event on the grid:

 

        private bool mHasGridMoved;

        private void FirstVisibleColumnChanged(object sender, EventArgs e)

        {

            mHasGridMoved = true;

        }

        private void CheckBoxCellMouseExit(object sender, EventArgs e)

        {

            DataCell dc = sender as DataCell;

            if (dc != null)

            {

                dc.CellEditorControl.MouseDown -= WinCheckBox_MouseDown;

                mHasGridMoved = false;

            }

            

        }

        private void CheckBoxCellMouseEnter(object sender, EventArgs e)

        {

            DataCell dc = sender as DataCell;

            if (dc != null)

            {

                dc.CellEditorControl.MouseDown += WinCheckBox_MouseDown;

                mHasGridMoved = false;

            }

            

        }

        private void WinCheckBox_MouseDown(object sender, MouseEventArgs e)

        {

            WinCheckBox checkBox = sender as WinCheckBox;

            if (checkBox != null && mHasGridMoved)

            {

                checkBox.Checked = !checkBox.Checked;

            }

        }

 

Imported from legacy forums. Posted by James (had 918 views)