How to bind MouseEnter,MouseLeave Event .

Topics: Prism v4 - Silverlight 4
Sep 26, 2012 at 12:25 PM

Hi

I am not able to figure out how to bind MouseEnter ,MouseLeave like  event to viewmodel.

I was thinking that it can be done through command and action delegate in delegate command.But i am not able to figure out how i can send object and event arg from view to view model.

So please if possible me clear with some sample of code.

 

Thanks in advance.

Developer
Sep 26, 2012 at 8:17 PM

Hi,

Although Prism supports the scenario of executing a command when an event is raised through its InvokeCommandAction, as far as I know, it doesn't support the scenario of passing the arguments of the event to a command as out of the box.

As a suggestion, I believe you could try the EventToCommand action of the MVVM Light Toolkit, as it supports the aforementioned behavior as out of the box:

Also, I believe you could find the following blog post useful, where an action that passes events to commands is proposed:

I hope this helps,

Damian Cherubini
http://blogs.southworks.net/dcherubini