How to customize PopupChildWindowAction buttons

Topics: Prism v4 - Silverlight 4
Jan 18, 2011 at 7:26 AM

When using PopupChildWindowAction, the ChildWindow button limited by Notification(OK button) or Confirmation(Ok button and Cancel button).

How to customize the buttons? i.e. add as many buttons as i want, and hook each button a Command in ViewModel?

Jan 18, 2011 at 1:49 PM


You could customize the ContentTemplate of your PopUpChildWindow as shown below:

           SourceObject="{Binding ConfirmCancelInteractionRequest}"> 
           ContentTemplate="{StaticResource ConfirmWindowTemplate}"/>

   <DataTemplate x:Key="ConfirmWindowTemplate">
       <Grid MinWidth="250" MinHeight="100">
           <TextBlock TextWrapping="Wrap" Grid.Row="0" Text="{Binding}"/>
           <Button> My New Button </Button>
           <Button> Other New Button </Button>

Here, the ConfirmWindowTemplate defines the view of your pop up window. You might find handy Prism´s Chapter 6: Advanced MVVM Scenarios, specifically the Using Behaviors To Implement The Interaction User Experience section, where this is explained in more detail.

As for how to wire the button to a command in the view model, you could read this thread, related on how to handle MVVM commands inside your data templates.

I hope you find this information useful.


Miguel Bronzovic

Jan 19, 2011 at 8:51 AM

Thank you very much , i will try it.