1

Currently when I double click on any grid item, below event is fired. This includes if I double click on headers as well.

Is there a way I can differentiate between header or rows clicked? SelectedItem position is always > 0

this.grdItems = new Janus.Windows.GridEX.GridEX();
...
this.grdItems.DoubleClick += new System.EventHandler(this.grdItems_DoubleClick);

private void grdItems_DoubleClick(object sender, System.EventArgs e)
    { 
        if (grdItems.SelectedItems!=null && grdItems.SelectedItems[0].Position >= 0)
        {
          //doing something
        }
    }
mechanicum
  • 699
  • 3
  • 14
  • 25

2 Answers2

0

One way is to use the HitTest() method

Declare your variables

public int MLastX { get; set; }
public int MLastY { get; set; }

Have a method to capture the co-ordinates of the last mouse click

/// <summary>
/// Handles the MouseDown event of the grdSearch control. On a mousedown the click co-ordinates
///  is set.  This method is used to determine whether you have clicked on a gridrow cell in the method above
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
private void grdSearch_MouseDown(object sender, MouseEventArgs e)
{
    MLastX = e.X;
    MLastY = e.Y;
}

Check if that click was in a cell

//check whether you have clicked in a cell 
if (grdSearch.HitTest(MLastX, MLastY) == GridArea.Cell)
{
   //now only execute the rest
}
Balagurunathan Marimuthu
  • 2,927
  • 4
  • 31
  • 44
0
private void mxGridExJanus1_RowDoubleClick(object sender, Janus.Windows.GridEX.RowActionEventArgs e)
{
    if (e.Row.RowType != RowType.Record) return;

    // row clicked
}
Tobias Tengler
  • 6,848
  • 4
  • 20
  • 34
Mostafa Bagheri
  • 366
  • 2
  • 7
  • 19