title: CheckBox Show/Hide TextBox WPF
body: <p>As the title says, Iam trying to show/hide a TextBox in WPF without writing code in MainWindow.xaml.cs file.</p>
  
  <p>Model:</p>
  
  <pre><code>public class Person
  {
      public string Comment { get; set; }
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;Window x:Class="PiedPiper.View.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      x:Name="Window"
      Title="WPF" Height="400" Width="400"&gt;
  
      &lt;CheckBox Content="Show comment" Name="CommentCheckBox"/&gt;
      &lt;TextBox Text="{Binding Comment, UpdateSourceTrigger=PropertyChanged}" Visibility="Hidden" Name="CommentTextBox"&gt;&lt;/TextBox&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>ViewModel:</p>
  
  <pre><code>    public class PersonViewModel : INotifyPropertyChanged
      {
      public PersonViewModel(Person person)
      {
          Comment = person.Comment;
      }
  
      private string _comment;
      public string Comment
      {
          get { return _comment; }
          set { _comment = value; OnPropertyChanged("Comment"); }
      }
  
      private void OnPropertyChanged(string propertyName)
      {
          var handler = PropertyChanged;
  
          if (handler != null)
          {
              handler(this, new PropertyChangedEventArgs(propertyName));
          }
      }
  
      public event PropertyChangedEventHandler PropertyChanged;
  }
  </code></pre>
  
  <p>So the TextBox should be hidden at start, but visible when checkbox is checked. Please help!</p>
  
  <p>Thanks.</p>