I have found that if I have a "parent" view model that derives from
IContextAware and it uses MEF constructor injection to compose "child" view models and also
other views, then it no longer gets a context (the corresponding "parent"
view) injected into it (InjectContext is passed null).
Only if the views are removed from the constructor injection does the "parent" view model successfully become context aware.
Is this by design; should I generally not be injecting views into view models (and instead using the ServiceLocator), or is there something else I should be doing to my views and/or view models to make this work properly?
It kind of makes sense that this is by design in a way, because, normally, a context-aware view model should know about a single view (its context). As soon as you start injecting other views into it via its constructor, it all of a sudden doesn't know which
context it should be aware of and therefore stops being context-aware.