Reputation: 709
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
}
}
Upvotes: 1
Views: 1809
Reputation: 413
private void mxGridExJanus1_RowDoubleClick(object sender, Janus.Windows.GridEX.RowActionEventArgs e)
{
if (e.Row.RowType != RowType.Record) return;
// row clicked
}
Upvotes: 0
Reputation: 1
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
}
Upvotes: 0