MouseLeftButtonDown dosent seem to be working the way I would expect. It only seem to fire if no rows/cells are in the Grid. Once there are cells or rows it does not fire.
I dont want to attach events at a cell or row level as I am trying to use MVVM and thus wish to Bind to a delegatecommand in my view model.
Marcus
4 Answers, 1 is accepted
As of Q3 MouseUp/MouseDown events are handled by RadGridView and for the time being the only way to listen for those events is to subscribe using code. For example:
using
Telerik.Windows.Input;
...
Mouse.AddMouseDownHandler(element, OnMouseDown,
true
);
...
private
void
OnMouseDown(
object
sender, Telerik.Windows.Input.MouseButtonEventArgs args)
{
}
Depending on your scenario it is not mandatory to subscribe for mouse events on all rows or cells. Subscribing for those events of RadGridView only might do the job. Could you please provide more information about your scenario so that we could try to provide an acceptable solution.
We have just recently introduced the AddMouseDownHandler with three argument where the last one allows you to handle already handled events. The new method is available in our latest internal build.
We are also evaluating several ideas on how we can improve the current situation with event handling and we will try to provide better experience as soon as possible
Best wishes,
Milanthe Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Hi
Thanks for the reply, it has helped some what.
What I was wanting to do is hook up a row "double click" to a command in my VM.
Ideally I would like to do this all in Xaml
Marcus
Hello Marcus Lambert,
I am afraid that it would be impossible to wire the command using XAML due to the internal event handling.
Would it be possible to handle the events using code and manually invoke the command of your View Model? For example:
private
void
OnMouseDown(
object
sender, Telerik.Windows.Input.MouseButtonEventArgs args)
{
// double click
if
(args.ClickCount >= 2)
{
// execute my ViewModel command
}
}
We are sorry for this inconvenience.
Sincerely yours,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.