title: WPF Trigger for IsSelected in a DataTemplate for ListBox items
body: <p>I have a listbox, and I have the following ItemTemplate for it:</p>
  
  <pre><code>&lt;DataTemplate x:Key="ScenarioItemTemplate"&gt;
      &lt;Border Margin="5,0,5,0"
              Background="#FF3C3B3B"
              BorderBrush="#FF797878"
              BorderThickness="2"
              CornerRadius="5"&gt;
          &lt;DockPanel&gt;
              &lt;DockPanel DockPanel.Dock="Top"
                         Margin="0,2,0,0"&gt;
                  &lt;Button HorizontalAlignment="Left"
                          DockPanel.Dock="Left"
                          FontWeight="Heavy"
                          Foreground="White" /&gt;
                  &lt;Label Content="{Binding Path=Name}"
                         DockPanel.Dock="Left"
                         FontWeight="Heavy"
                         Foreground="white" /&gt;
                  &lt;Label HorizontalAlignment="Right"
                         Background="#FF3C3B3B"
                         Content="X"
                         DockPanel.Dock="Left"
                         FontWeight="Heavy"
                         Foreground="White" /&gt;
              &lt;/DockPanel&gt;
              &lt;ContentControl Name="designerContent"
                              Visibility="Collapsed"
                              MinHeight="100"
                              Margin="2,0,2,2"
                              Content="{Binding Path=DesignerInstance}"
                              Background="#FF999898"&gt;
              &lt;/ContentControl&gt;
          &lt;/DockPanel&gt;
      &lt;/Border&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>As you can see the ContentControl has Visibility set to collapsed.</p>
  
  <p>I need to define a trigger that causes the Visibility to be set to "Visible"</p>
  
  <p>when the ListItem is selected, but I can't figure it out.</p>
  
  <p>Any ideas? </p>
  
  <p>UPDATE: Of course I could simply duplicate the DataTemplate and add triggers
  to the ListBox in question to use either one or the other, but I want to prevent duplicating this code.</p>