I have a WPF MVVM app that using PRISM. I have a toolbar UserControl which is bind to the ViewModel so it can invoke the commands on the ViewModels as shown below:
<ToolBar Height="auto">
<Button Content="New"/>
<Button Content="Edit" Command="{Binding Path=EditCommand}" CommandParameter="{Binding SelectedItem}" />
<Button Content="Refresh"/>
<Button Content="Delete"/>
<Button Content="Close"/>
</ToolBar>
The EditCommand invoke the following method in the ViewModel:
private void Edit(UserViewModel userViewModel)
{
// load the edit page
}
In the Edit method I need to replace the current window with the edit window. How can I do that? I do not want to create or use UI elements in the Edit method because it goes against the MVVM model architecture.