How to create notification control using MVVM?
I'm creating my first application using MVVM. I'd like to have a usercontrol that shows开发者_开发技巧 the results of some functions. Something like VS Error List. I.E. if I choose some xml file in some other usercontrol and try to deserialize it, I'd like to have on this notification list some info like "Deserialization complete" or "Deserialization error". There is more than one control that should send such notifications.
As I said it's my first MVVM project and I'd like to know what kind of solution should I choose to accomplish this task.
The best way to do that is to use Messaging for this. I prefer to use MVVM light and if you use that you can create your own type of Message and broadcast that message from several locations in your application and Register to that message in the Usercontrol to show these messages.
Example of Messaging with MVVM Light can be found here: http://blog.galasoft.ch/archive/2009/09/27/mvvm-light-toolkit-messenger-v2-beta.aspx
精彩评论