title: wpf: How popup a usercontrol?
body: <p>Background:
  I have a project which use the datagrid to display the data, and the datagrid has a rowdetail column which include a usercontrol. The usercontrol has some TextBox for user inputing and displaying some message. </p>
  
  <p>Problem:
  I want to make the usercontrol popup when I click a button, and the popuped usercontrol has the same context as the usercontrol's in the rowdetail column of datagrid. The intention of doing so is to make it easy for users to interactive with the usercontrol because that room of the rowdetail cell is limited.</p>
  
  <p>The usecontrol has be implemente and it can work normally in the rowdetail cell. However, I have no idea about how to pop it up without change its context, such as data source, messages have been display in the TextBox, etc.. Anyone can give me some advices?
  By the way, I use the MVVM pattern.</p>
  
  <p><strong>EDIT:</strong>
  Here is the RowDetailTemplate:</p>
  
  <pre><code>    &lt;DataTemplate x:Key="RowDetailTemplate"&gt;
      &lt;Grid x:Name="RowDetailGrid" HorizontalAlignment="Left" Width="850" Height="355" &gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="*" /&gt;
              &lt;ColumnDefinition Width="100" /&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;my:MyUserControl x:Name="myUserControl" /&gt;
          &lt;Button Grid.Row="1" Width="60" Height="25" Content="Pop Up" 
                      Command="{Binding Path=PopupCommand}"/&gt;
          .....
      &lt;/Grid&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>Here is the usercontrol (MyUserControl in the above codes):</p>
  
  <pre><code>&lt;UserControl x:Class="MyProject"
           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" 
           d:DesignHeight="300" d:DesignWidth="600"&gt;
  &lt;Grid&gt;
      &lt;ScrollViewer  Margin="0" HorizontalScrollBarVisibility="Disabled" &gt;
          &lt;StackPanel&gt;
              &lt;ItemsControl Grid.Row="0" ItemsSource="{Binding Output, Mode=OneWay}" FontSize="12"&gt;
                  &lt;ItemsControl.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                              &lt;TextBlock TextWrapping="Wrap" Text="{Binding Path=.}" Foreground="White" /&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/ItemsControl.ItemTemplate&gt;
              &lt;/ItemsControl&gt;
              &lt;DockPanel Grid.Row="1" LastChildFill="True"&gt;                    
                  &lt;TextBox Text="{Binding Input, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" 
                       TextWrapping="Wrap"
                       BorderBrush="{x:Null}" SelectionBrush="{x:Null}" 
                       BorderThickness="0" Width="Auto"&gt;
                      &lt;TextBox.InputBindings&gt;
                          &lt;KeyBinding Command="{Binding Path=TextBoxEnter}" Key="Enter" /&gt;
                      &lt;/TextBox.InputBindings&gt;
                  &lt;/TextBox&gt;
              &lt;/DockPanel&gt;
          &lt;/StackPanel&gt;
      &lt;/ScrollViewer&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>