Easy:
public EndingViewModel EndingViewModel { get { return ServiceLocator.Current.GetInstance<EndingViewModel>(Guid.NewGuid().ToString()); } }
When enabling ServiceLocator, make sure that the GetInstance call passes a unique value to the method. In the above example, I am passing a pointer.
I really wonโt build your objects manually, as this will defeat the point with the Injection Dependency container in MVVM Light.
source share