Is there any way to capture double click on the cell especially when cell is not in edit mode? I know there is no such event in current GridView, but is it something that we can expect in your Q1 release? I was just thinking about it because this is a functionality very widely used in regular asp.net grid through javascript and this functionality is not available in silverlight DataGrid aswell. And at the same time we need this functionality.
Since we are using someother telerik controls and are really happy with them and also considering to use Telerik control aswell, which will depend on the distinct features we will get from telerik GridView.
I will be very glad if we could get the functioanlity of double click from RadGrid.
Would love to know your thoughts about this issue?
Best Regards
Osama
35 Answers, 1 is accepted
Yes - we are working on that. This will be available in the next version.
Best wishes,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Is this feature (or something similar) implemented on Telerik Q1 2009 package?
Thanks.
Regards,
Rogério
Yes - it is - give it a try and let us know if you hit any problems.
Sincerely yours,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Could you tell me what's the event that I must subscribe?
Thanks.
Regards,
Rogério
The event is called "MouseDoubleClick", and is a member of the GridViewCell class.
You can use it by attaching a class handler like that:
RadGridView1.AddHandler(GridViewCell.MouseDoubleClickEvent, new EventHandler<RadRoutedEventArgs>(this.OnCellDoubleClick));
private void OnCellDoubleClick(object sender, RadRoutedEventArgs e)
{
/// your logic here ...
}
Please let us know if you have any other questions.
Best wishes,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Thanks for the information!
It seams to work fine! I'll let you know if I found any issue!
Regards,
Rogério
Am I missing something?
Thanks
Steve
AddHandler is extension method and you need to register Telerik.Windows namespace.
Greetings,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I try to add handler in VB.NET but I receive an error...
this is the code:
[MyGrid is a RadGridView]
MyGrid.AddHandler(Telerik.Windows.Controls.GridView.GridViewCell.MouseDoubleClickEvent, System.Delegate.CreateDelegate(GetType(System.EventHandler), MyGrid, "OnDoubleClickCellaGrigliaListino"))
and
Public Delegate Sub OnDoubleClickCellaGrigliaListinoHandler(ByVal sender As Object, ByVal e As RadRoutedEventArgs)
Public Sub OnDoubleClickCellaGrigliaListino(ByVal sender As Object, ByVal e As RadRoutedEventArgs)
... my logic here
End Sub
what's wrong?
Thanks
Paolo
Try with this:
Public Sub New() |
InitializeComponent() |
Me.MyGrid.[AddHandler](GridViewCell.MouseDoubleClickEvent, _ |
New EventHandler(Of RadRoutedEventArgs)(AddressOf Me.OnDoubleClickCellaGrigliaListino)) |
Me.MyGrid.ItemsSource = GetMessages() |
End Sub |
Public Sub OnDoubleClickCellaGrigliaListino(ByVal sender As Object, ByVal e As RadRoutedEventArgs) |
' your logic here |
End Sub |
I have attached a small sample project. I hope it helps.
Regards,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
it works perfectly!
many thanks!!!
Paolo
Hello Ross,
Would it be possible for you to post the same solution in C#?
I keep getting 'Argument type 'Telerik.Windows.RoutedEvent' is not assignable to parameter type 'System.Windows.RoutedEvent'
when trying to add the handler in C# syntax.
Thanks!!
Please check this demo for more info about double click.
Regards,Vlad
the Telerik team
---------------------------
Could not load file or assembly 'Telerik.Windows.Controls.Input, Version=2010.2.714.1040, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest. (Exception from HRESULT: 0x80131053)
--------
It get stuck after reaching 100
Have you tried to clear your browser cache?
Best wishes,Vlad
the Telerik team
What kind of browser is being used? Could you please try to run the demos with another browser?
Kind regards,
Milan
the Telerik team
I also tried in XP 32 bit, in a 'brand new' virtual machine. I was redirected to install the latest Silverlight and some web development tools.
Same error.
Well, it seems that this is a caching problem but the strangest thing is that, as you have said, clearing the browser cache does not help. What I could suggest is to download our installation package which will install our demos on your local machine and you should be able to view them.
Regards,
Milan
the Telerik team
I think the company proxy must be caching something. I was able to see the demo from home. These are the steps that I followed to subscribe to the doubleclick in the grid. It works. Thank you!
In the code-behind class:
1) Inherit class from
INotifyPropertyChanged
2) Add
public event PropertyChangedEventHandler PropertyChanged;
3) After InitializeComponent() is called add
YourNamedRadGridView.AddHandler(GridViewCellBase.CellDoubleClickEvent, new EventHandler<RadRoutedEventArgs>(OnCellDoubleClick), true);
4) Finally add the event handler:
private void OnCellDoubleClick(object sender, RadRoutedEventArgs args) {
GridViewCellBase cell = args.OriginalSource as GridViewCellBase;
if (cell != null) {
//RUN CODE FOR DOUBLE CLICK HERE
}
}
I have a strange behaviour implementing the CellDoubleClickEvent that I didn't had before
It seems that the code reacting to a double click event is also being fired by a left click then right click combination if it's being done quick enough
It's a bother for me since I have implemented a function on double click event (the primary function) and other secondary functions on a context menu on each row.
When my users go to select a row (right click) then display the context menu (left click), it triggers the default action of double click event.
Any ideas ?
Why not use RowActivated instead? Please check this demo for more info.
Kind regards,Vlad
the Telerik team
This example is very good and works fine. Just a little question, Is possible AddHandler in XAML?
This is the code to do in code behin
this
.RadGridView1.AddHandler(GridViewCellBase.CellDoubleClickEvent,
new
EventHandler<RadRoutedEventArgs>(OnCellDoubleClick),
true
);
I want to do the same but in the XMAL.Thank you.
I am afraid that in this particular instance it is not possible to subscribe to this event in XAML.
Sincerely yours,
Milan
the Telerik team
http://www.dansoltesz.com/post/2010/02/19/Silverlight-datagrid-double-click-behavior.aspx
Not telerik specific, but the pattern applies to any control.
I am sending you yet another sample project illustrating how you may handle double-clicking creating a custom behavior.
All the best,
Maya
the Telerik team
Such event is still not available but you might consider using RowActivated event which is demonstrated on this demo.
Hope it helps.
Best wishes,
Milan
the Telerik team
This basic ability should already be there!
HELP!!!!
May you provide a bit more information on your requirements ? Why subscribing to the RowActivated event, CellDoubleClickEvent or using an attached behavior are not appropriate for your scenario ?
Generally, all three approaches will enable you to handle the case when a mouse is double-clicked.
Maya
the Telerik team
This is a complex issue. Can I talk to someone?
Firstly, if you want to be able to select multiple items, you may set the SelectionMode property of the grid to "Multiple" or "Extended". As for defining and using a ContextMenu, you may take a look at our online demos for further reference.
Considering your requirement for selecting an item on double-click, you may cancel the built-in selection during the SelectionChanging event, handle the CellDoubleClickEvent for example and select the corresponding items.
Still, I would recommend you using the default way a selection is performed, as otherwise you will probably have to consider the cases when you are selecting multiple items.
Maya
the Telerik team
The event is at GridViewCellBase level as illustrated in our demos.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>