title: MVVM + WPF + Popup = clueless
body: <p>I'm still working on modifying my existing WPF application to be "compliant" with the MVVM approach.  I'm getting pretty darned close, but am not sure how to solve one of remaining few hurdles.</p>
  
  <p>I have a GUI element (currently a button, though it could be a label), where when the mouse enters it, it fires the MouseEnter event, and this creates a popup in the code-behind.  The popup is composed of a simple stackpanel layout with several buttons.  Each button's Click event currently is assigned to the same event handler, except that I change the Tag property to do a simple (cheesy) command parameter.  I'm wrestling with the "correct" way to do this in MVVM, because the way I'm doing it now is pretty ugly.</p>
  
  <p>In order to solve this, I think this is the direction I should head in, but would appreciate any additional input you can offer me.  :)</p>
  
  <ol>
  <li><p>Create Popup in XAML.  Since my Popup contents are static, I should be able to create the Popup entirely in XAML.  In addition, each button would be bound to the same ICommand-derived class.  e.g.</p>
  
  <pre><code>&lt;Popup x:Key="MyPopup" StaysOpen="False" Placement="Right"&gt;
      &lt;Border Background="White" BorderBrush="Black" Padding="5" BorderThickness="2" CornerRadius="5"&gt;
          &lt;StackPanel Orientation="Vertical"&gt;
              &lt;Button Command="{Binding MyCommand}" CommandParameter="5"&gt;5&lt;/Button&gt;
              &lt;Button Command="{Binding MyCommand}" CommandParameter="10"&gt;10&lt;/Button&gt;
              &lt;Button Command="{Binding MyCommand}" CommandParameter="15"&gt;15&lt;/Button&gt;
              &lt;Button Command="{Binding MyCommand}" CommandParameter="20"&gt;20&lt;/Button&gt;
          &lt;/StackPanel&gt;
      &lt;/Border&gt;
  &lt;/Popup&gt;
  </code></pre></li>
  <li><p>Make the Popup pop up via a Trigger, e.g.</p>
  
  <pre><code>                        &lt;Button.Triggers&gt;
                              &lt;Trigger Property="Button.IsMouseOver" Value="True"&gt;
                                  &lt;Setter TargetName="MyPopup" Property="IsOpen" Value="True" /&gt;
                              &lt;/Trigger&gt;
                          &lt;/Button.Triggers&gt;
  </code></pre></li>
  </ol>
  
  <p>I <em>think</em> #1 is ok, but I am struggling with #2.  Is this the right way to approach the problem?  And if so, what's the correct XAML syntax for getting the Popup's IsOpen property to be set to True?  I couldn't find examples for this.</p>
  
  <p>If my whole thinking is flawed, I would love to hear what my other options are.  Thanks!</p>