.net - How to close a UserControl View in mvvm-light? -


I created a sample with mainView and 2 other views (usercontrols). I have kept the button "closed" on the child's view and I want to close that scene. There is a command associated with that button, and when close is pressed I ask ViewModelLocator to clean it.

BUt-view is still being displayed .. What am I doing wrong? How can I turn off the user control view with mvvm-light?

  Private relay comand _ close command; Close Public Relay Commands {{{(_closeCommand == faucet) {_closeCommand = New relay command = (=) = & gt; ViewModelLocator.ClearAllChannels (),); } Return _closeCommand; }}  

ViewModelLocator function:

  public static zero clear AllChannels () {if (_allChannels! = Null) {_allChannels.Cleanup (); _allChannels = Null; }} 

The view model lokater does not actually host your thoughts, it's just a specific Provides a way to view ViewModel supporting the view.

So you have to ask those controls that host your thoughts (possibly a window or frame) to shut them down.


Comments