NotificationEventArgs

Nov 13, 2012 at 8:13 PM

Hello!

Where would be a good place to start with using the NotificationEventArgs? I looked at the documentation and it didnt help as much as i would have liked. What I am trying to do is have a View for a status String and a Status Progress Bar (which other views can access). I know i have to use the NotificationEventArgs but i am not sure how to implement them into my project. If it would help, I could post some sample code.

Thanks,

zs

Coordinator
Nov 13, 2012 at 9:53 PM

Check out my blog post on modal dialogs, which uses NotificationEventArgs to facilitate two-way communication between a ViewModel and View.

http://blog.tonysneed.com/2011/01/28/tackling-the-problem-of-modal-dialogs-in-mvvm/

Cheers,

Tony

Nov 13, 2012 at 11:38 PM
Edited Nov 13, 2012 at 11:39 PM

After reading through the blog, I am still a little confused on exactly how I can translate that to my purpose. I am just getting started with MVVM and I can honestly say, my head is spinning!

For clarification on exactly what I am doing, I have 2 views. I have a view that outputs the data that is being processed and another view that shows the status. (I have it that way because I will have Many Views that will use the Status View.) All I can see with the NotificationEventArgs, I can only pass a single string. I need to be able to send a string and a double. Does this mean that I would have to create 2 NotificationEventArgs?

Thanks

zs

PS. thanks for the quick reply

Coordinator
Nov 14, 2012 at 12:30 AM
From the sound of it, you may not need NotificationEventArgs, but you may just want to bind each of your two Views to the same ViewModel. For that just create a ViewModel by adding a new item. That ViewModel will have properties which the Views will bind to. There are a number of steps you need to take. Have you watched the Getting Started video tried repeating those same steps? That will help you climb the learning curve.

Cheers,
Tony
Nov 14, 2012 at 8:54 PM

Would I really want to have just one ViewModel through, I could have up to 39 different views that could possibly interact with this view. The project I am currently working on is a very complex and complicated program. I am not new to c#, just to MVVM, would MVVM be something that I should be considering for a project of this scale?

zs

Coordinator
Nov 14, 2012 at 9:17 PM

MVVM is designed to provide separation between layers in your client app, mainly in order to allow for better testability and integration of graphic designers in the development process.  If neither one is of concern for you, then MVVM could be overkill.  On the other hand, it sounds like you may want to visualize a ViewModel in different ways, so this may lend itself to MVVM.  Check out this aricle: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx.

Cheers,
Tony