zynthh
❔ ✅ Trouble getting Dependency Injection to work in a WPF application
Thanks all for your answers. I think my question was kind of answered, but I guess I will just normally instantiate an instance of my Service in my Page and use DI where nothing "frontend" is involved.
Or if anyone knows a way how I can achieve it (maybe by refactoring the Page to a Component idk) please let me know.
48 replies
❔ ✅ Trouble getting Dependency Injection to work in a WPF application
OK that doesn't sound very good tbh. I'm wondering now, if you're even supposed to use DI with WPF that way.
Have you used it in that way before? Or maybe someone else? I would love your feedback. 😄
In the end I could always just instantiate my Service normally in
SomePage
and everything should work, right?48 replies
❔ ✅ Trouble getting Dependency Injection to work in a WPF application
That doesn't work either. I don't want to inject SomePage anywhere, so why would I need to register it? I mean I tried it but it still doesnt't work.
I want to inject SomeService into SomePage. And SomeService is registered. Maybe it's the way SomePage is being used in my MainWindow?
Could that be a reason for my error?
48 replies
❔ ✅ Trouble getting Dependency Injection to work in a WPF application
No, I transferred it into my project. He didn't have an example for what I'm trying to achieve. That is, injecting a dependency into another dependency basically.
I just found out that, if I remove the injection of SomeService in SomePage, the app builds just fine.
48 replies