Feb 4, 2011 at 9:15 AM
Edited Feb 4, 2011 at 9:17 AM
Hi there. Thanx for the reply.
On reading my question again, I see I was not very clear.
My problem is this. I'm loading a treeview, so the imports of the viewModel of the treeview are automatically injected. Then I dynamically load all the items in the tree & create viewModels for them. Because I'm creating these viewModels,
their imports are not injected.
My solution to this is to export the container in the bootstrapper' ConfigureContainer override
protected override void ConfigureContainer()
//Export the CompositionContainer so we can import it if neccesary.
Now the Container is available to be imported by my TreeViewModel, so I can pass it as a parameter in the constructors of the individual viewModels of the treeitems. Each treeItemViewModel can now run SatisfyImportsOnce(this) to inject their dependencies.
Is this the correct way to do this, or is there a better way?