Hi,
I've craeted a sample with mainView and 2 other views (usercontrols). I've placed a button "close" on the child view and i want to close that view. there is a command attached to that button, and when close is pressed i ask the ViewModelLocator to clean it.
BUt- the view still being displayed.. What i'm doing wrong? How can i close a userControl view with mvvm-light?
private RelayCommand _closeCommand;
public RelayCommand CloseCommand
{
get
{
if (_closeCommand == null)
{
_closeCommand = new RelayCommand(()=>
ViewModelLocator.ClearAllChannels(),
);
}
return _closeCommand;
}
}
ViewModelLocator function:
public static void ClearAllChannels()
{
if (_allChannels != null)
{
_allChannels.Cleanup();
_allChannels = null;
}
}