|
Not a stupid question at all, Toby, but not entirely covered within the scope of this project! Would honestly suggest you do a bit of research of standard usage patterns of IoC containers, and then apply that to your WinRT code with metroioc.
That said, you will almost definitely want to create a singleton instance of the container for the whole app to use - don't create a container per view!
One way to achieve this is what you suggest - by using a service locator to resolve the IoC container, and you can spin this up in App.xaml.cs
Personally, most of the xaml apps I write use Caliburn Micro (http://caliburnmicro.codeplex.com/) so I wire up the IoC in the Bootstrapper there...
Remember the fight club rule, though! (you don't talk about the IoC container) - if you find multiple calls to IoC.Resolve() littered through your code, then there's almost certainly something wrong; or at least something that could be improved by some refactoring.
There is a long 'todo' list on this project that I'm, frankly, 6 months away from addressing. I may put 'add sample project' onto that list...
thanks ;)
Ian
|