title: Show/Hide a Control in a WPF User Control
body: <p>I have 3 buttons in a user control, I would like to <strong>show and hide one button from the WPF application</strong> or from the user control. Its not working for me. I have implemented <code>INotifyPropertChanged</code> interface to notify the View. Please check it.</p>
  
  <pre><code>&lt;UserControl x:Class="WPFUserControl.UserControl1"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
           mc:Ignorable="d" 
           xmlns:vis="clr-namespace:WPFUserControl"
           d:DesignHeight="300" d:DesignWidth="300"&gt;
  &lt;UserControl.Resources&gt;
      &lt;vis:BoolToVisibilityConverter x:Key="BoolToVis" &gt;&lt;/vis:BoolToVisibilityConverter&gt;
  &lt;/UserControl.Resources&gt;
  &lt;Grid&gt;
      &lt;Button Content="Button1" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75"/&gt;
      &lt;Button Content="Button2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="106,0,0,0"/&gt;
      &lt;Button Content="ShowHide" Visibility="{Binding IsShowHideVisible, Converter={StaticResource BoolToVis}, ConverterParameter=False}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="215,0,0,0"/&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>public partial class UserControl1 : UserControl, INotifyPropertyChanged
  {
      private bool isShowHideVisible;
      public bool IsShowHideVisible
      {
          get { return isShowHideVisible; }
          set
          {
              if(isShowHideVisible!=value)
              {
                  isShowHideVisible = value;
              }
          }
      }
      public UserControl1()
      {
          InitializeComponent();
         // IsShowHideVisible = false;
      }
  
      private void OnPropertyChange(string pPropertyName)
      {
          if(PropertyChanged!=null)
          {
              PropertyChanged(this, new PropertyChangedEventArgs(pPropertyName));
          }
  
      }
  
      public event PropertyChangedEventHandler PropertyChanged;
  }
  </code></pre>