I am trying to achieve something how it is possible in excel,
On right clicking outside the selected cells, excel un-select the previous selected cell, select the current row and shows the pop up menu but in syncfusion Gridgroupingcontrol doesn't clear the previous selection when I right clicking outside the selected cells.
Can you please suggest how to do the same using Gridgroupingcontrol?
Hi Ragamathullah,
Thanks for your reply,
Issue: When I right click outside the selected cells, Grid control doesn't clear previous selections.
Expected Behavior: When I right click outside the selected cells, Grid control should be clear previous selections and select the current cell as active cell.
Can you please suggest how to do the same using Gridgroupingcontrol?
Hi Mendel,
Thank you for your update.
If you want to clear the selections on MouseRight Click in GridGroupingControl, you can clear the selection by handing TableControlMouseDown event. For this, you need to disable the AllowSelection property to None and ListBxSelectionMode as MultiExtended. Please make use of below code and attached sample,
Code Snippet:
this.gridGroupingControl1.TableOptions.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.None;
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.gridGroupingControl1.TableModel.Options.SelectCellsMouseButtonsMask = System.Windows.Forms.MouseButtons.Left;
this.gridGroupingControl1.TableControlMouseDown += new GridTableControlMouseEventHandler(gridGroupingControl1_TableControlMouseDown);
void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
if (e.Inner.Button == System.Windows.Forms.MouseButtons.Right)
{
if (this.gridGroupingControl1.Table.SelectedRecords != null)
{
foreach (SelectedRecord rec in this.gridGroupingControl1.Table.SelectedRecords)
{
this.gridGroupingControl1.Table.SelectedRecords.Remove(rec);
}
}
}
}
Please let me know if you have any concerns.
Regards,
Neelakandan