Is there any way to show contextmenu
on DataGridView
without selecting row? I want both ways to show contextmenu
on DataGridView
by selecting row and by not selecting row. Here is my code for showing contextmenu
on selected row.
Any help would be much appreciated.
private void ProductServicesDataGrid_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
var hti = ProductServicesDataGrid.HitTest(e.X, e.Y);
ProductServicesDataGrid.Rows[hti.RowIndex].Selected = true;
ProductContextMenu.Show(ProductServicesDataGrid, e.X, e.Y);
}
}