Click here to Skip to main content
15,900,707 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am working on a window application using WPF with MVVM pattern C#.

There is a MainWindow, as a container window, where different UserControls loaded/unloaded according to the requirements.
Now, on a UserControl, I have a grid showing available items and one "Add Items" button at the bottom of the UserControl. On this button click, execute a command and, i want open a modal popup with 2 textboxes, OK and Cancel buttons(Add some new items into a Grid on UserControl). And want to bind textboxes and button commands with same viewmodel as my parent UserControl's viewmodel.

Kindly suggest, optimized way to achieve this...

Thanks and Regards,
Zaheer
Posted
Updated 24-Dec-13 21:26pm
v2

1 solution

From your description I would think about having a base View class that has the ability of showing itself in a window or in an existing control.

So, when you load/unload a view you can tell the View to either load itself into some container (as it presumably does now) or to pop itself up into a window.

I do something similar in my MVVM articles here[^]
 
Share this answer
 

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