Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

473
Visualizações
How to select checkbox when click on any cell in the table except clicking on checkbox icon? DevExpress

I have a C# devexpress project. I am using the checkbox for my project. Here is the screenshot of my design.

enter image description here

I want to click the "In Price" and "Out Price" cell, and select the rows (multiple. To be exact: I have a number of rows. If I click a cell, the cell will be selected, if I click another row cell, the first-row will still remain selected, and then the second one also be selected.)

Here is a demo of what I exactly expecting: enter image description here

I am assuming that, because of the Toggle button, only if I click on the checkbox column, it is selected. If I need to turn it off, How can I do that?

If I need to write code what I am expecting, the code will be written:

private void gridView2_RowCellClick(object sender, RowCellClickEventArgs e)
        {
            if (e.Column.FieldName == "InPrice" || e.Column.FieldName == "OutPrice")
            {
                //Here I need to write the code.
            }
        }
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

private void gridView2_RowCellClick(object sender, RowCellClickEventArgs e)
        {
            if (e.Column.FieldName == "InPrice" || e.Column.FieldName == "OutPrice")
            {
                         
                if ((Control.ModifierKeys & Keys.Control) != Keys.Control)
                {
                    GridView view = sender as GridView;
                    GridHitInfo hi = view.CalcHitInfo(e.Location);
                    if(hi.InRowCell)
                    {
                        view.FocusedRowHandle = hi.RowHandle;
                        view.FocusedColumn = hi.Column;
                        view.ShowEditor();
                        CheckEdit edit = (view.ActiveEditor as CheckEdit);
                        if(edit != null)
                        {
                            edit.Toggle();
                            (e as DevExpress.Utils.DXMouseEventArgs).Handled = true;
                        }
                    }
                }
            }
        }

This code works what I exactly wanted. If anyone need this, it may help you.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda