Wednesday, April 25, 2012

Open only single instance of view

From my ShellViewModel I have below command binding to open another window "Remote View"



public ICommand RemoteViewCommand
{
get { return new RelayCommand(RemoteViewExecute, CanRemoteViewExecute); }
}

private void RemoteViewExecute()
{
if (!CanRemoteViewExecute())
{
return;
}

//call restore view
//new ShellRemoteView().Show();

ShellRemoteView shellRemoteView = Application._Container.Resolve<ShellRemoteView>();
shellRemoteView.DataContext = Application._Container.Resolve<ShellRemoteViewModel>();
shellRemoteView.Show();
}


ie Every time I click button on shellView -> it opens as much instances of remote view.
How can I achieve only single instance of RemoteView to be opened/activate each time.
Any help would be really appreciated





No comments:

Post a Comment