I have an IValueConverter implemented class and I need it to be injected using my DI container (Ninject).
The problem is, in XAML, there's no immediately obvious way to get control over the instantiation of the Converter object.
So my XAML contains a line something like this:
Source="{Binding Path=CurrentMessage, Converter={StaticResource ImagePathConverter}}"
Where, the ImagePathConverter will be created for me.
I suppose I could create a "service locator" static class and call it to resolve my dependency and change the StaticResource to a property "MyServiceLocator.TheImageConverter", but that makes me want to vomit.
I'm looking to Prism, as I hear it has answers for this. But I've trundled my way through tutorials and code a few times without finding an obvious simple isolated answer to this issue. Although I am happy to use it.
I am hoping this question can be answered with a few snippets of code that specifically target the code supplied - and perhaps a supporting link to an example. Not simply a recommendation to take a look somewhere (sorry to say this but I've seen this done elsewhere and found it annoying)
Also, very importantly, assume that the XAML does not have a code-behind - and that I cannot use one. I'm creating a skin and do not want a code behind. So I cannot set a class variable in the class constructor and reference it. Maybe that's unreasonable, I'm not sure yet.