
Zbigniew Kozłowski
Top achievements
Rank 1
Zbigniew Kozłowski
asked on 02 Aug 2010, 09:32 AM
Hi,
how can i check if user double clicked on row? Because now double click works on everything, so if someone scroll the grid and double click on the row the event is fired, same when user double click on header column etc. I need to fire double click only on row. Also how can i make double click work only on left button? i checked in MouseButtonEventArgs e, i can see if it was left but i see only last click so i dont know if the first click was with right button or not.
how can i check if user double clicked on row? Because now double click works on everything, so if someone scroll the grid and double click on the row the event is fired, same when user double click on header column etc. I need to fire double click only on row. Also how can i make double click work only on left button? i checked in MouseButtonEventArgs e, i can see if it was left but i see only last click so i dont know if the first click was with right button or not.
7 Answers, 1 is accepted
0
Hello Zbigniew Kozłowski,
You can achieve this with two alternative approaches:
- use celldoubleclick event (you need to check args.OriginalSource type to determine whether you are clicking on row, header or footer).
- use row activated event
Please check this example - http://demos.telerik.com/silverlight/#GridView/ClickEvents for more information.
If you have any other issues or questions do not hesitate to contact us.
Regards,
Tsvyatko
the Telerik team
You can achieve this with two alternative approaches:
- use celldoubleclick event (you need to check args.OriginalSource type to determine whether you are clicking on row, header or footer).
- use row activated event
Please check this example - http://demos.telerik.com/silverlight/#GridView/ClickEvents for more information.
If you have any other issues or questions do not hesitate to contact us.
Regards,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

JC
Top achievements
Rank 1
answered on 08 Nov 2010, 04:51 AM
Hi,
I tried the code from the link but I'm getting an error when compiling. Please see the attached screen cap. What's wrong with the code?
Here's my code:
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls.GridView;
using System.Windows.Resources;
using System.ComponentModel;
namespace EMPR_Main.UserControls
{
public partial class SearchSVP : UserControl, INotifyPropertyChanged
{
private GridViewCellBase clickedCell;
public GridViewCellBase ClickedCell
{
get
{
return clickedCell;
}
set
{
clickedCell = value;
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs("ClickedCell"));
}
}
}
public SearchSVP()
{
InitializeComponent();
rgrdResults.AutoGenerateColumns = false;
rgrdResults.AddHandler(GridViewCellBase.CellDoubleClickEvent, new EventHandler<
RoutedEventArgs
>(OnCellDoubleClick), true);
}
private void OnCellDoubleClick(object sender, RoutedEventArgs args)
{
MessageBox.Show("test");
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
}
0
Hello JC,
You have passed
Let me know if you have any further issues.
All the best,
Tsvyatko
the Telerik team
You have passed
RoutedEventArgs
instead RadRoutedEventArgs arguments in the handler and method.Let me know if you have any further issues.
All the best,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

JC
Top achievements
Rank 1
answered on 08 Nov 2010, 08:31 PM
Got it. Thanks!
I added a reference to the Telerik.Windows namespace. The sample code did not show that.
I added a reference to the Telerik.Windows namespace. The sample code did not show that.
0

Xavier Hutchinson
Top achievements
Rank 2
answered on 27 Apr 2011, 12:49 AM
*deleted*
0

Rene
Top achievements
Rank 1
answered on 17 May 2011, 02:50 AM
Hi Tsvyatko,
Unfortunately the sample code does not work 100% to the time, specifically, double clicking a *column header* should not be considered as a valid section to click on.... at least that is my opinion.
Is there any way that the sample code can be modified so that column headers are ignored too?
Thanks.
0
Hello Rene,
Maya
the Telerik team
The event will be fired for GridViewCellBase. If you do not want to perform the required actions on a GridViewHeaderCell, you may verify the type of the cell - whether it is a GridViewCell or GridViewHeaderCell - in the event handler and execute them only for the cells you want.
Maya
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items