StyleMVVM.View.AttachedEventCommand is obsolete

Oct 3, 2013 at 9:43 PM
warning CS0618: 'StyleMVVM.View.AttachedEventCommand' is obsolete: 'Use Message.Attach in favor of AttachedEventCommand'

I want to use Messaging to respond to view events, but there is no documentation nor samples on how to avoid the above warning with the correct Message.Attach.

Is there anyone who can teach me how to use message instead of attached events?

Thanks in advance
Oct 3, 2013 at 10:02 PM
Edited Oct 4, 2013 at 2:15 AM
Hi JCKodel,

An example of how to hookup the Click event to a method on your viewmodel called SomeMethod

view:EventHandlers.Attach="Click => SomeMethod();"

Here is another example of how to pass the sender and event args to the method

view:EventHandlers.Attach="Click => SomeMethod(sender,eventArgs);"

You can also attach multiple handlers in the same attach statement

view:EventHandlers.Attach="Click => SomeMethod(sender,eventArgs); Loaded => LoadMethod();"

Oct 4, 2013 at 2:22 AM
Hi JCKodel,

Also you can check out the documentation on connecting events

And in the sample application there is a page for Commands and Events that you can look at for an example on connecting event handlers

Oct 4, 2013 at 2:25 AM
Thank you.

I was thinking about MessageBus when I saw "Message.Attach". =)
Oct 4, 2013 at 2:33 AM
Your welcome,

Any other questions post away.