I'm instantiating a View throught the Unity, and this View has a ViewModel as parameter. However, this ViewModel has three other parameters, which two of them are already configureted on Unity, and the last parameter I need to get from the MainView that open the SecondView. (Crazy, hm?)
This method is called from my MainView (first view) when a button is clicked:
private void ShowAddVersionViewExecute()
{
Window view = UnityServiceConfigurator.Instance.GetUnityContainer().Resolve<AddVersionView>() as Window;
view.ShowDialog();
}
This is my AddVersionView (second view), which has its ViewModel as parameter.
public partial class AddVersionView
{
public AddVersionView(AddVersionViewModel viewModel)
{
//InicializeComponents and set the viewModel to DataContext.
}
}
This is the AddVersionViewModel's constructor
public AddVersionViewModel(IDialogService dialog, AbstractRepository repository, string versionNumber)
{
//Some code here.
}
The IDialogService and AbstractRepository are resolved by Unity. BUT I want receive the "versionNumber" from the MainView.
- How/What am I supposed to do it?
- Is there any other way to perform that?
Thanks a lot.