AVOID This Anti-Pattern... But Here's How It Can Help in WPF
July 5, 2024
• 579 views
wpfwinuinet mauimvvmwpf codewpf mvvmwpf uixamlwpf corewpf data bindingdata bindingdotnetwpf .net corewpf data binding c#wpf controlswpf ui designwpf netmvvm tutorialwpf designxaml tutorialwpf xamlformat xamlvisual studioclean codesoftware engineeringC#mvvm wpfdata binding in wpfIValueConverterbindingcodingService Locator Patternanti patternsprogramming antipatternsdependency injectionservice locator.net
Here's an anti-pattern you've been told to avoid -- and for good reason.
Except... I'm going to show you how it can SAVE YOUR BUTT in WPF.
You're going to have to understand WHY it's not great so you can later try to solve this problem in a better way.
In my opinion, WPF doesn't do a great job with dependency injection. In fact, many of the patterns in WPF make it feel like a battle against DI frameworks.
In this video, I'll show you how we can use the Service Locator anti-pattern to work around this when building value converters. I'll explain why I don't like it, how it will help, and then follow up with what we can do better.
