1

I'm currently using Prism for a WPF application, and I'm searching for several things with Prism an dialogs.

The direction I found is the "InteractionRequestTrigger", and there is some example with it.

I found how to open a simple popup, and a custom popup, but there is several things I didn't found:

  1. Is there a way to open a OpenFileDialog or SaveFileDialog with this interactivity request?
  2. For custom control, I would like to use the Windowof DevExpress, where/how do I specify this? Also, where should the options of this windows(like the width/height, the style of the window, if it is resizable, ...)
  3. Is there a way to have a ViewModel for each popup? Because I will definitely Commands and a lot of other things to be bound in this popup
  4. When we do a confirmation/notification, it seems that this doesn't use the MessageBox, but in fact a window? Is there a way to use the MessageBox(to be coherent with the system)?
J4N
  • 19,480
  • 39
  • 187
  • 340
  • 1
    Personally I am not a big fan of WPF's built-in popups, so usually use a custom UserControl instead. The code for it can be found [here](https://rachel53461.wordpress.com/2011/08/20/popup-panel-for-wpf/) if you're interested in doing something similar for #3. For #1, I usually consider `OpenFileDialog` and `SaveFileDialog` part of the View layer of the application, so usually implement in code behind the View. And for #2/4, I almost never use multiple windows in WPF, and typically recommend against it. I'm not sure I could offer any advice there beyond *"don't do it"* :) – Rachel Jul 07 '16 at 14:48
  • For #3, see http://stackoverflow.com/questions/35238759/prism-custom-confirmation-interaction/35239947#35239947 It's actually straightforward, just use `ViewModelLocator.AutoWireViewModel="True"` in the popup view. – Haukinger Jul 07 '16 at 15:55
  • @Haukinger Ok I see, but is there a way to not duplicate every field in the Notification and in the ViewModel? Ideally I would like to be able to create the ViewModel, give it to the view, then once its business is finished, retrieve the updated VM. – J4N Jul 07 '16 at 16:43
  • @Rachel Thank you for the link, but for basic dialogs, we use devExpress, so we won't have to create a brand new thing. For #1: ok, but this action has to be triggered from a command in my ViewModel, which doesn't know the code behind. For 2/4: We have some "options" or properties editable with a contextal menu, or some wizard, we don't really have the choice here. – J4N Jul 07 '16 at 16:46
  • In the notification, you only need stuff that is either passed to the popup or returned from it. You could always put a model instance (with all the fields you need) in there and expose it in the popup's view model. – Haukinger Jul 07 '16 at 17:01
  • For #1 use a dialog service instead. Do not use code behind for that. Since you are using a dialog service #2 and #3 is no problem. MessageBox is crap, use your own dialog in your dialog service. –  Jul 07 '16 at 23:48
  • @BrianLagunas Which DialogService? Because initially I thought of doing my own, but after that I had several issues, requiring more and more code(to mention: having to wrap all settings of Open/SaveFileDialog, having to handle the owner, retrieve the View matching the ViewModel that has been giving in parameter.) And I was thinking it has probably already be done once. – J4N Jul 08 '16 at 05:03

0 Answers0