Pop up a new window on command click

Topics: Prism v2 - WPF 3.5
Jul 28, 2010 at 12:17 AM

I have implemented the RegionPopupBehavior as in the RI of Prism. I want to bring up a new window pop up on a button click. I am activating the view in a Secondary region as RI. How to command bind a button command to open this new window view? 

Jul 30, 2010 at 11:06 PM

Hi,

Based on our understanding, you have a WPF application using Prism and need to implement command bindings that eventually might open a pop-up window like in the RI.

In Prism is provided an infrastructure for leveraging commands. For more information, you could take a look at the following documentation section (see the Binding Commands to a View section) on MSDN:

On the other hand, once you configured your command in XAML by following the instructions in the link provided above, you would want to know where to handle it. So, this design decision could be taken by choosing the presentation pattern to be used in your application. For more information about these patterns you could check the following links:

The last step is the implementation of the Command itself (i.e. the handler). One of the most used approaches in Prism is the usage of DelegateCommand. Additionally, you could use the original way to create a custom Command by implementing the ICommand interface. For more information of these topics:

No matter if you choice to use the first option or the second one. In both cases, you would indicate a CanExecute method and a ExecuteMethod. The former one will notify the UI control whether it is possible to execute, and the other act as the handler method where you could write your logic.   

In addition, you could check the Commanding Quickstart.

Please let me know if this helps.

Fernando Antivero
http://blogs.southworks.net/fantivero

Aug 6, 2010 at 11:11 PM

Thanks Fernando,

I have implemented the pop well. Now I have a small problem. some of my pop up views vary in sizes. Is there a way I can adjust the pop up window size on rum time?