We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Stopping deselection when clicking

Hi there

Can anybody tell me if you can stop highlighted rows from being deselected when you right click on the selected rows?

Thanks

Richard


1 Reply

NR Nirmal Raja Syncfusion Team August 5, 2008 06:28 AM UTC

Hi Richard,

Thank you for your interest in Syncfusion product.

The row selection can be done manually using an event called PrepareViewStyleInfo, which will help to manage selection on both right click and left click.
If this does not help, Please let me know which control you are using or if possible please send me a sample of yours.

Sample code:
gridGroupingControl1.TableControl.PrepareViewStyleInfo += new Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventHandler(TableControl_PrepareViewStyleInfo);

void TableControl_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
GridCurrentCell cc = gridGroupingControl1.TableControl.CurrentCell;
GridControlBase grid = this.gridGroupingControl1.TableControl.CurrentCell.Grid;
if (e.RowIndex > grid.Model.Rows.HeaderCount && e.ColIndex > grid.Model.Cols.HeaderCount
&& cc.HasCurrentCellAt(e.RowIndex))
{
e.Style.Interior = new BrushInfo(SystemColors.Highlight);
e.Style.TextColor = SystemColors.HighlightText;
e.Style.Font.Bold = true;
}
}

Let me know if you have any queries.

Regards,
Nirmal


Loader.
Live Chat Icon For mobile
Up arrow icon