First of all, thank you very much for dropping this comment. Feedback is always welcome. Regarding the follow-up, I didn't create it due to lack of time. What I try to do in this channel is mostly creating videos on things that I actively work on during my day to day job. I think that this is a point that sets this channel out when compared to others. I try to not just create tutorials, but create videos that actually start from real applications as this is what I think brings value to viewers. Unfortunately, I didn't get to continue the work on a .NET Core WPF app so that's why the follow-up is missing. I'll try however to plan it for within the next month.
I would like to know if you do more videos for WPF with .NET 6? for .NET6 is correct to still use "Microsoft.Extensions.Hosting" or there are a better alternative?
Hi Sir, Thank you very much for the nice tutorial, can you please put video on handling multiple pages using DI. I am having problem hiding one page and opening other page.
So I assume that in case of MVVM, you would also need to register the ViewModels as singleton, in case they have those services passed in as arguments in the ctor?
Thank you very much for your feedback. I don't really disagree with your argument, but on the other side it shows a certain misunderstanding of the topic of the video itself. This video was created shortly after WPF got ported to the .NET Core family and DI was suddenly possible almost out of the box (and, yes, DI should be used even in WPF apps). The video then just shows how to setup the .NET Core DI container in a WPF application and how you can resolve services where you need them. It was just a demo of a new feature/possibility. Nobody promoted this as being a best practice and a way to follow. On the other hand even Microsoft docs, or DevExpress docs clearly state that DI can be used in View to resolve ViewModels and by ViewModels to resolve the needed services. I'm for sure not an expert on this topics, but my experience shows me that a lot of things in software engineering are not as black or as white as we sometimes tend to make them look.
You can also create a XAML markup extension to assign DataContext with injected parameters to your view: community.devexpress.com/blogs/wpf/archive/2022/02/07/dependency-injection-in-a-wpf-mvvm-application.aspx
I'm familiar with the MVVM architectural pattern, though I'm not sure if I would use a library for that. This being said, that's clearly an aspect I still have to learn more about and research more thoroughly. But I still think that using the #DotNetCore DI container might be useful.
@@Codewrinkles Yes deffinitly, in .net framework it was unitycontainer and consorts but I quess they will fade away now that .net core has it's own container. Prism is more for modularity and navigation, but never tried in in .net core.
What you show only work for Windows child classes. WPF apps are composed of many other UserControls and Controls child classes. They must have parameter less constructor in order to be instantiated by XAML parser. You are not giving solution for this and the title of the video is misleading. I would like to show me how to inject dependency into custom TextBox control.