This project is read-only.

StyleMVVM.View.AttachedEventCommand is obsolete

Oct 3, 2013 at 10: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 11:02 PM
Edited Oct 4, 2013 at 3: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();"

Thanks
-Ian
Oct 4, 2013 at 3:22 AM
Hi JCKodel,

Also you can check out the documentation on connecting events

https://stylemvvm.codeplex.com/wikipage?title=Commands%20And%20Events&referringTitle=Documentation

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

Thanks
-Ian
Oct 4, 2013 at 3:25 AM
Thank you.

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

Any other questions post away.