This is nitpicking, but this message (10:07) should be something like "is already mapped to type {Mappings[typeofTViewModel]}" to show the current mapping not the new requested mapping
Thanks for the detailed video. Just started to lern WPF with MVVM. Haven't found a single example for creating a Modal dialog..... why not start from simple yet not perfect way of implementing it and then develop it more and more?? This is really frustrating for me...
Thank You for sharing the idea, one problem that I see, that your approach can only work with windows applications. My requirement was to implement it in context of core library to use it with wpf and also xamarin plattforms. So I have used an other approach by using the Action class and Callbacks.
I haven't built a Xamarin application, but you would have to adapt a solution for it. The concept is the same: create an abstraction by defining the appropriate interfaces, and create a mediator to handle the actual display of the dialog. A single solution for both Xamarin and WPF could be tricky if there isn't any commonality between them, but probably very possible. I would have to take a deeper look at Xamarin to be more helpful.
Very nice, I like the idea. I see only one issue. owner will always be read as null. I have modified the constructor and owner field so I can set it later, however I'm not sure if i should do that.
+Piotr Morawski You set the owner in App.xaml when you instantiate the dialog service via its constructor. Typically to MainWindow. Shouldn't be null. It would be null in a unit test though, since there is no ui/owner
DCOM Engineering, LLC Yes I know, however later you set MainWindow. For example if I want to set startuplocation of the dialog to a parentcenter, it will not work, because the owner is null. Any ideas?
Very very nice !! I would give you 1000 "thumbs up" if it was possible :-) and good to see you posting again, long time i was waiting for new tutorials!
12:12 Is it really necessary? Isn't viewModel disposed with the view (after it's closed)? Which means that all event handlers are disposed as well, aren't they? Am I missing something? Can you please explain?
If you don't need the viewModel anymore then yes, it gets disposed. But there are often situations when you need the data from the dialog window returned. For example: create_customer/order/etc dialog. Thats why you create the viewModel before calling the ShowDialog method.
I love your framework and using it in my proyect thanks a lot. I have two questions with this video. How can adapt the code if the owner is a user control instead of a window. And how can i adapt it if a have to get two strings back from the dialog like if i want to use it as a login form? Thanks in advance.
Thanks for your video. I have used Prism interaction triggers to open popup. What are the benefit of using Dialog service (your method) over prism interaction? Which one you recommend?
Hi there - I really enjoy your videos. Very informative. I'm trying to implement a solution like this with a unity bootstrapper but I'm struggling on figuring out how to implement it in the bootstrapper. It might be worth noting that I'm using Prism as the mvvm framework. I know that I can load the initialize the dialog service in the main window viewmodel constructor but I know that there is probably a better way to do it in the bootstrapper. Any ideas?
I am a beginner at WPF and in C#, please I have many questions about MVVM and it would be great if you can help me, first What is MVVM ? and why are we writing so much code just to display a simple dialog ??! aren't there suppose to be some built-in classes that takes care of all that background work like in android studio and java ??? is this truly necessary ?? I've downloaded your source code and didn't understand a thing from the code. what can I do to understand what the hell is going on ?
MVVM Stands for Model - View - ViewModel and is just a design pattern to build UI applications. We use this pattern to seperate UI, Logic and data which makes code re-usable, dynamic and easily unit testable. By implementing the DialogService shown in the video, you're avoiding tight coupling between your UI (View) and logic (ViewModel). The code shown in the video might be complex to understand if you're unfamilar with concepts such as abstraction or generics. Follow and listen to understand whats happening.
The primary reason for the dialog abstraction is the unit testing of the view model. You can't have dialogs showing in a unit test, and especially so in a build server. Testability, reusability and separation of logic from the view is the primary purposes of a view model. If you were writing a small CRUD application with minimal logic and no unit tests, something like this is not necessary, but its an essential pattern in medium to large code bases
Definitely easy to follow along with. The volume on the otherhand...that's another story. I had to play the video on my TV and turn it's volume up to 100% just to hear it. Good job otherwise!
I was searching weeks for this solution. Thank you!
Thanks for providing the corrected video in your description!
Love your videos, but the audio is very low even with max volume on several of my devices/computers. Can this be improved? Thank you.
I believe I have corrected this on newer videos. I will monitor this!
This is more of a problem because we have set the playback volume to the max, and when the ads play they are super loud.
I also can't hear the audio watching the first Bourne on the small player here on the right.
Good to see you posting again.
Thanks. Your tutorial helped me a lot.
This is nitpicking, but this message (10:07) should be something like "is already mapped to type {Mappings[typeofTViewModel]}" to show the current mapping not the new requested mapping
Thanks for the detailed video. Just started to lern WPF with MVVM. Haven't found a single example for creating a Modal dialog..... why not start from simple yet not perfect way of implementing it and then develop it more and more?? This is really frustrating for me...
Thank You for sharing the idea, one problem that I see, that your approach can only work with windows applications. My requirement was to implement it in context of core library to use it with wpf and also xamarin plattforms.
So I have used an other approach by using the Action class and Callbacks.
I haven't built a Xamarin application, but you would have to adapt a solution for it. The concept is the same: create an abstraction by defining the appropriate interfaces, and create a mediator to handle the actual display of the dialog. A single solution for both Xamarin and WPF could be tricky if there isn't any commonality between them, but probably very possible. I would have to take a deeper look at Xamarin to be more helpful.
can you share your code for your approach using action and callbacks? Thanks
It freaking worked!!! unbeliavable :d:D :D :D
I'm glad you are back!
It was quite to the point, well done!
Very nice, I like the idea. I see only one issue. owner will always be read as null. I have modified the constructor and owner field so I can set it later, however I'm not sure if i should do that.
+Piotr Morawski You set the owner in App.xaml when you instantiate the dialog service via its constructor. Typically to MainWindow. Shouldn't be null. It would be null in a unit test though, since there is no ui/owner
DCOM Engineering, LLC Yes I know, however later you set MainWindow. For example if I want to set startuplocation of the dialog to a parentcenter, it will not work, because the owner is null. Any ideas?
Great content, but the audio is unusually low.
really liked this approach - my only issue is incorporating it with MEF. Still struggling to get my head around a lot of WPF and MVVM concepts
If you can elaborate I can probably help with your MEF issue.
Thanks for the reply - I have one more thing to try and figure it out on my own, but will certainly ask if it does not work
Very very nice !!
I would give you 1000 "thumbs up" if it was possible :-)
and good to see you posting again, long time i was waiting for new tutorials!
More to come.. I have a list..
Volume?
12:12 Is it really necessary? Isn't viewModel disposed with the view (after it's closed)? Which means that all event handlers are disposed as well, aren't they? Am I missing something? Can you please explain?
If you don't need the viewModel anymore then yes, it gets disposed. But there are often situations when you need the data from the dialog window returned. For example: create_customer/order/etc dialog. Thats why you create the viewModel before calling the ShowDialog method.
Great video! Thanks for linking to your project. One question, why does the IDialog interface need a reference to the Window Owner?
How do I implement dialogService in opened dialog, if I want to open more dialogs from already opened dialog?
I love your framework and using it in my proyect thanks a lot. I have two questions with this video. How can adapt the code if the owner is a user control instead of a window. And how can i adapt it if a have to get two strings back from the dialog like if i want to use it as a login form? Thanks in advance.
Thanks, is it possible to fix the download link for the source code?
Good work!
can`t hear anything
Do you have a service for calling modeless dialog? Thanks
I don't, but it would be pretty easy to write one using events or a mediator. You can take this same concept and try and write your own :)
Thanks for your video.
I have used Prism interaction triggers to open popup. What are the benefit of using Dialog service (your method) over prism interaction?
Which one you recommend?
Hi there - I really enjoy your videos. Very informative. I'm trying to implement a solution like this with a unity bootstrapper but I'm struggling on figuring out how to implement it in the bootstrapper. It might be worth noting that I'm using Prism as the mvvm framework. I know that I can load the initialize the dialog service in the main window viewmodel constructor but I know that there is probably a better way to do it in the bootstrapper. Any ideas?
Excellent but very low volume, had to pump up volume level to hear a little
There is a link in the description to a corrected video.
very nice, but this is very hard to me, only to show dialog. :)
You show a link in the description with a Video with the corrected audio, why can't you just upload the Video with the corrected audio here?
Why don't you show the result in the end?
After uploading did you ever hear the voice ....its very low
Fixed audio in video description
@@DX7Dev Really?
@@DX7Dev what does it mean 'Fixed audio in video description
'
I am a beginner at WPF and in C#, please I have many questions about MVVM and it would be great if you can help me, first What is MVVM ? and why are we writing so much code just to display a simple dialog ??! aren't there suppose to be some built-in classes that takes care of all that background work like in android studio and java ??? is this truly necessary ?? I've downloaded your source code and didn't understand a thing from the code. what can I do to understand what the hell is going on ?
MVVM Stands for Model - View - ViewModel and is just a design pattern to build UI applications. We use this pattern to seperate UI, Logic and data which makes code re-usable, dynamic and easily unit testable. By implementing the DialogService shown in the video, you're avoiding tight coupling between your UI (View) and logic (ViewModel).
The code shown in the video might be complex to understand if you're unfamilar with concepts such as abstraction or generics.
Follow and listen to understand whats happening.
The primary reason for the dialog abstraction is the unit testing of the view model. You can't have dialogs showing in a unit test, and especially so in a build server. Testability, reusability and separation of logic from the view is the primary purposes of a view model. If you were writing a small CRUD application with minimal logic and no unit tests, something like this is not necessary, but its an essential pattern in medium to large code bases
Okay but I don't understand the code, where can I start with the basics of MVVM ?
See my MVVM session 1, intro video
How to handle dialog with ( Save, Don't Save ,Cancel )
Same way but you model your view appropriately to have that information about the dialog, such as a property with an enum that gets set
What? I don't hear you!
There is a corrected video in the description
Noice!
is that all just to pop up a dialog !!!
Definitely easy to follow along with. The volume on the otherhand...that's another story. I had to play the video on my TV and turn it's volume up to 100% just to hear it. Good job otherwise!
I added a corrected volume video link in the description.
Please fix the volume.
Potentially this might be a good video. Couldn't hear a thing though.
There is a fixed audio version in the description
I cant hear what you're saying.
Fixed the audio and there's a new link in the description
WHAT????? HELLO??? IS THERE AUDIO ON THIS??? CAN YOU SPEAK UP???? Another person that has no idea how to set the correct audio level in a video....
There is a link to a fixed video in the video description. Sorry about that.