Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
We are taking an ancient ASP application and moving it to Silverlight using the MVVM design pattern. We are using Prism and Unity for the MVVM framework. We are not using MEF.

We have one form that works with multiple tables and I have most (if not all) addressed. The one in issue is the only application that breaks away from the 'notes' application and handles it in their own form. We want to have an 'Add Comment' button which will expose a popup, gather the data, then update the comment table when done.

What is the best practise for handling the popup process? Should I make it a view that CanShow on it's own with it's own viewmodel supporting it? (the approach I'm thinking of)

It seems if I keep an instance of it in Unity, have the event get the object and show it, have the creation of it bind to the view model, and have injection deal with the lender we are working with, it should keep things still quite separated while also making this usable when we address the Notes application as well.

Is this the best approach or is there a better / simpler approach without binding the popup to the data.
Posted

1 solution

In case anyone is wondering....my approach does seem to work quite well.

I have the popup defined in Unity as a Reference.
I have the view model defined in Unity as well.

I use unity to create an instance of the view and it has it's own view model instantiated via Prism.
I then register a subscribe to the CommentCreationComplete event and use that to close the window and re-get the data in the view model.

Works quite smoothly with binding only to the event of Add Comment and that calling a method in the view model.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900