c# MVVM hide buttons that you've clicked
<p>I've a homework for a hangman game. I'd like in the buttonFunction or somewhere else, the button I've pressed to come Hidden and so on the next time and next.</p>

<p><strong>MainWindow:</strong>
    </p>

<pre><code>&lt;Window.DataContext&gt;
    &lt;vm:MainWindowViewModel /&gt;
&lt;/Window.DataContext&gt;
&lt;Grid&gt;
    &lt;Grid.RowDefinitions&gt;
        &lt;RowDefinition Height="59*"/&gt;
        &lt;RowDefinition Height="55*"/&gt;
        &lt;RowDefinition Height="68*"/&gt;
        &lt;RowDefinition Height="65*"/&gt;
        &lt;RowDefinition Height="72*"/&gt;
    &lt;/Grid.RowDefinitions&gt;
    &lt;Grid.ColumnDefinitions&gt;
        &lt;ColumnDefinition Width="13*"/&gt;
        &lt;ColumnDefinition Width="34*"/&gt;
    &lt;/Grid.ColumnDefinitions&gt;
    &lt;Button Grid.Column="0" Grid.Row="0" Command="{Binding ButtonClick}" CommandParameter="a"&gt;
        a
    &lt;/Button&gt;
    &lt;Button Grid.Column="0" Grid.Row="1" Command="{Binding ButtonClick}" CommandParameter="b"&gt;
        b
    &lt;/Button&gt;
    &lt;Button Grid.Column="0" Grid.Row="2" Command="{Binding ButtonClick}" CommandParameter="c"&gt;
        c
    &lt;/Button&gt;
    &lt;Button Grid.Column="0" Grid.Row="3" Command="{Binding ButtonClick}" CommandParameter="d"&gt;
        d
    &lt;/Button&gt;
    &lt;Button Grid.Column="0" Grid.Row="4" Command="{Binding ButtonClick}" CommandParameter="e"&gt;
        e
    &lt;/Button&gt;
    &lt;TextBox Text="{Binding Path=DisplayWordInTextbox, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="2"/&gt;
&lt;/Grid&gt;
</code></pre>

<p></p>

<p><strong>MainWindowViewModel:</strong></p>

<pre><code>using System;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Input;

namespace test.ViewModel
{
class MainWindowViewModel : INotifyPropertyChanged
{
    private string[] words;
    private string currentWord;
    private string copyCurrentWord;

    private string displayWordInTextbox;
    public string DisplayWordInTextbox
    {
        get
        {
            return displayWordInTextbox;
        }
        set
        {
            displayWordInTextbox = value;
            NotifyPropertyChanged("DisplayWordInTextbox");
        }
    }

    public MainWindowViewModel()
    {
        buttonClick = new RelayCommand(buttonFunction);
        loadWordsFromFile();
        selectWord();
        displayWord();
    }

    public event PropertyChangedEventHandler PropertyChanged;
    private void NotifyPropertyChanged([CallerMemberName] String propName = "")
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propName));
        }
    }

    private ICommand buttonClick;
    public ICommand ButtonClick
    {
        get
        {
            return buttonClick;
        }
        set
        {
            buttonClick = value;
        }
    }

    void buttonFunction(object obj)
    {
        string buttonContent = obj.ToString();

        if (currentWord.Contains(buttonContent) || currentWord.Contains(buttonContent.ToUpper()))
        {
            char[] temp = copyCurrentWord.ToCharArray();
            char[] findWord = currentWord.ToCharArray();
            char guessChar = buttonContent.ElementAt(0);
            for (int i = 0; i &lt; findWord.Length; i++)
            {
                if (findWord[i] == guessChar || findWord[i] == Char.ToUpper(guessChar))
                {
                    temp[i] = findWord[i];
                }
            }
            copyCurrentWord = new string(temp);
            displayWord();
        }
        else
        {
            System.Windows.MessageBox.Show(buttonContent + " isn't found!");
        }
    }

    private void loadWordsFromFile()
    {
        words = new string [] {"cat", "dog"};
    }

    private void selectWord()
    {
        int randomWordIndex = (new Random()).Next(words.Length);
        currentWord = words[randomWordIndex];
        char[] currentWordArray = currentWord.ToArray();
        bool isWord = false;

        for (int i = 0; i &lt; currentWord.Length; i++)
        {
            for (char c = 'a'; c &lt;= 'z'; c++)
            {
                if (currentWordArray[i] == c || currentWordArray[i] == Char.ToUpper(c))
                {
                    isWord = true;
                }
            }
            if (isWord == true)
            {
                copyCurrentWord += "_";
                isWord = false;
            }
            else
            {
                copyCurrentWord += currentWordArray[i];
            }
        }
        words = words.Where(w =&gt; w != words[randomWordIndex]).ToArray();
    }

    private void displayWord()
    {
        DisplayWordInTextbox = "";
        for (int i = 0; i &lt; copyCurrentWord.Length; i++)
        {
            DisplayWordInTextbox += copyCurrentWord.Substring(i, 1);
            DisplayWordInTextbox += " ";
        }
    }
  }
}
</code></pre>