Static Resources in WPF
I have a class in WPF that is referred to in XAML as a view control:
<ctrl:MyController x:Key="Controller"/>
Now I can access this as a static resource, and everything is fine:
Command="{Binding Source={StaticResource Controller}, Path=HistoryFutureRetrieveLeft,
Mode=OneTime}">
However, now I need to create a controller using the IOC container. I can do this with the following code:
Resources.Add("Controller", App.IocContainer.Resolve<MyController>());
But I need to remove the line from XAML:
<ctrl:MyController x:Key="Controller"/>
This is not a run-time problem, but it causes a problem when trying to edit XAML, because now all the bindings say "Resource controller not found." Is there a way to allow the IOC container to create a controller at runtime, but define the controller in the XAML file exclusively for the VS constructor?