This is a migrated thread and some comments may be shown as answers.

How to get the contents of a row (Model) simply by mousing over the row

3 Answers 36 Views
GridView
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 09 Dec 2019, 04:21 PM
How to get the contents of a row (Model) simply by mousing over the row? I'm trying to cache the row, that is, it's underlying model when a user mouses over the row. 

3 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 12 Dec 2019, 02:34 PM

Hello John,

To achieve your requirement, you can subscribe to the MouseEnter event of the GridViewRow elements. To do this, you can use the RowLoaded and RowUnloaded events of RadGridView.

<telerik:RadGridView RowLoaded="RadGridView_RowLoaded" RowUnloaded="RadGridView_RowUnloaded"/>

private object hoveredRowModel;

private void RadGridView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
{
	if (e.Row is GridViewRow)
	{
		e.Row.MouseEnter += Row_MouseEnter;
	}
	
}

private void RadGridView_RowUnloaded(object sender, Telerik.Windows.Controls.GridView.RowUnloadedEventArgs e)
{
	if (e.Row is GridViewRow)
	{
		e.Row.MouseEnter -= Row_MouseEnter;
	}
}

private void Row_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
{
	var row = (GridViewRow)sender;
	this.hoveredRowModel = row.Item;
} 

Regards,
Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
John
Top achievements
Rank 1
answered on 12 Dec 2019, 10:07 PM
Thank you kind sir... I'm off till Monday... But I'll it then... Thank you so much sir the help, much appreciated... Happy holidays.. 
0
Martin Ivanov
Telerik team
answered on 13 Dec 2019, 08:51 AM

Hello John,

Happy holidays to you too.

Regards,
Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
John
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
John
Top achievements
Rank 1
Share this question
or