How to hide the Grid using a button click event in Silverlight mvvm?


In my project (Silverlight5 with MVVM), i need to hide the Grid using button click event. here the button also located in the grid. Is there anyway to hide this grid..?

Your viewmodel should contain property (for example, IsGridVisible):

public bool IsGridVisible
   get {return _isGridVisible;}
   set {
          _isGridVisible = value;

Then, you can bind Grid.Visibility to your IsGridVisible property, thought BoolToVisibilityConverter.

And then, you can simply switch state in your button`s command handler.