How to raise mouse button events from code behind when we have only mouse position? I need to raise mouse events from code behind in different positions of screen.
views:
47answers:
1
+1
A:
Umm.. quite simply no you can't.
Edit
Now that you've describe what it is you actually need to do (a useful techinque in getting your problems solved). Here is the solution:-
Use the AddHandler
method to attach a handler for the MouseLeftButtonDown and the MouseLeftButtonUp.
myPanel.AddHandler(UIElement.MouseLeftButtonDown, MyButtonDown_Handler, true);
Note the final true
parameter is the enabler here, it indicates that your handler should be called even if another element has indicated that the event has been handled.
Whilst you cannot add a handler for MouseMove
in this way that is not a problem since MouseMove
cannot be marked as handled anyway, so you just attach a handler to the Panel for MouseMove
in the normal manner.
AnthonyWJones
2010-07-26 11:40:50
Maybe you can suggest some other solution of my problem?
bgodiy
2010-07-26 12:18:38
Thank you very much!
bgodiy
2010-07-26 13:19:34