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

GGC: Move highlighted Record with mouse

Hi!

When I move the mouse over a GGC, I want to move the currently highlighted RecordRow with it. How can this be managed? Is there a property that solves this problem? Or do I need to manage the Highlighting manually?


Regards
Falk

1 Reply

HA haneefm Syncfusion Team April 16, 2007 04:03 PM UTC

Hi Falk,

One way you can do this by turn ON the record based selection technique and then handle the MouseMove event of the GridTableControl to add/remove the mouse moveover record using the Table.SelectedRecords property. Here is a code snippet to show this.

//Turn ON Record - based selection.
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
//Turn OFF Cell - based selection.
this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None;


this.gridGroupingControl1.TableControl.MouseMove +=new MouseEventHandler(TableControl_MouseMove);

Record LastRec = null;
private void TableControl_MouseMove(object sender, MouseEventArgs e)
{
GridTableControl tc = sender as GridTableControl;
Point pt = new Point(e.X,e.Y);
Element el = tc.PointToNestedDisplayElement(pt);
if( el.Kind == DisplayElementKind.Record)
{
Record rec = el.GetRecord();
if( LastRec != null )
tc.Table.SelectedRecords.Remove(LastRec);
if( rec != null )
{
tc.Table.SelectedRecords.Add(rec);
LastRec = rec;
}
}
}

Sample : GGCMouseMove.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon