DialogService in WPF apps?

Oct 9, 2015 at 9:31 PM
Are there any examples of implementing IDialogService in a WPF application? What is the recommended best practice for this?
Coordinator
Oct 9, 2015 at 9:41 PM
Hi,

The simplest way is to leverage MessageBox.Show in your implementation, but it's not very elegant.

A more elegant way is to build a custom Windows and use this as a modal dialog box.

I know that I am super late in writing samples, life gets in the way a lot this year. Sorry about that.

Laurent
Oct 26, 2015 at 4:51 PM
Please give a sample on how to use custom window as a modal/non modal dialog in bounds of MVVM Light.
Dec 17, 2015 at 7:11 PM
I would also like to see an example of how to implement IDialogService in a WPF application. I'm currently using MessageBox.Show, but it doesn't fit very well with the IDialogService methods. For example, you cannot override the text displayed on the MessageBox buttons.
Coordinator
Nov 18 at 12:33 PM
Hi,.

Please see the sample below. Note that this is just a proposed implementation, there are many ways one could do dialogs or navigation in WPF.

https://1drv.ms/u/s!As15SQCXjw37p7IeUvd8zgVRn9frTA

Hope this helps
Laurent
Nov 19 at 5:04 PM
Sending parameters to custom dialogs can be made hugely easier if we have just one more parameter in IDialogService.ShowMessage() call. Instead of:
Task<bool> ShowMessage(string message, string title, string buttonConfirmText, string buttonCancelText, Action<bool> afterHideCallback);
make it:
Task<bool> ShowMessage(string message, string title, string buttonConfirmText, string buttonCancelText, Action<bool> afterHideCallback, object data = null);
Or can you suggest another way of sending an object from ViewModel layer to my custom dialog in View layer?
Coordinator
Nov 23 at 7:16 AM
Hi,

That's a valid suggestion. I will add this to the backlog.

Laurent