title: Open a WPF Popup with a button
body: <p>I'm trying to open a Popup with a button and have implemented a basic ICommand.  The button is binded to the ICommand OpenPopupCommand while the Popup IsOpen attribute is binded to the "IsOpen" OnPropertyChanged.  My thought process was to bind the Popup.IsOpen attribute to the ICommand as well to have IT trigger the OnPropertyChange but couldn't get it to work.  I think I'm close but can't figure it out.  Here is the code I have so far:</p>
  
  <pre><code>    #region ICommand Members
  
      private ICommand _openPopupCommand;
      public ICommand OpenPopupCommand
      {
          get
          {
              if (_openPopupCommand == null)
                  _openPopupCommand = new RelayCommand(param =&gt; OpenPopupExecute(param));
              return _openPopupCommand;
          }
          set 
          {
              _openPopupCommand = value;
          }
      }
  
      #endregion
  
      #region Methods
  
      public void OpenPopupExecute(object parameter)
      {
          parameter = true;
          OnPropertyChanged("IsOpen");
      }
  
      #endregion
  </code></pre>
  
  <p>Button that "pops up" the Popup and the Popup XAML:</p>
  
  <pre><code>&lt;Popup x:Name="FieldsPopup" Placement="Center" Width="400" Height="250" IsOpen="{Binding IsOpen}"&gt;
                      &lt;StackPanel&gt;
                          &lt;TextBlock Background="LightBlue" HorizontalAlignment="Center" VerticalAlignment="Center" Height="250" Width="350" TextAlignment="Center" &gt;This is a popup&lt;/TextBlock&gt;
                      &lt;/StackPanel&gt;
                  &lt;/Popup&gt;
  &lt;Button Name="button_PatientIdentifierList" Width="23" Height="23" Grid.Column="2" Foreground="Black" Background="#FFCDCDCD" BorderBrush="#FF707070" Margin="3.4,4,4,0" VerticalAlignment="Top" Command="{Binding OpenPopupCommand}"/&gt;
  </code></pre>