title: How to access controls parent's property in a style
body: <p>My Listview has items datatemplated as a label. I'm designing a style for that label and I don't know how to access the parent's(ListViewItem) IsSelected property.</p>
  
  <p>EDIT - tried the suggestions below, but still getting an exception, here's my complete code:</p>
  
  <pre><code> &lt;Style x:Key="ListViewItemStyle" TargetType="ListViewItem"&gt;
                  &lt;Setter Property="SnapsToDevicePixels" Value="true"/&gt;
                  &lt;Setter Property="OverridesDefaultStyle" Value="true"/&gt;
                  &lt;Setter Property="Template"&gt;
                      &lt;Setter.Value&gt;
                          &lt;ControlTemplate TargetType="ListViewItem"&gt;
                              &lt;Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true"&gt;
                                  &lt;GridViewRowPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/&gt;
                              &lt;/Border&gt;
                          &lt;/ControlTemplate&gt;
                      &lt;/Setter.Value&gt;
                  &lt;/Setter&gt;
                  &lt;Style.Triggers&gt;
                      &lt;Trigger Property="IsSelected" Value="True"&gt;
                          &lt;Setter Property="Background" Value="{StaticResource WindowBorderBrush}"/&gt;
                          &lt;Setter Property="Foreground" Value="White"/&gt;
                      &lt;/Trigger&gt;
                  &lt;/Style.Triggers&gt;
              &lt;/Style&gt;
              &lt;Style x:Key="GVLabelStyle"
                     BasedOn="{StaticResource LabelStyle}"
                     TargetType="Label"&gt;
                  &lt;Style.Triggers&gt;
                      &lt;MultiDataTrigger&gt;
                          &lt;MultiDataTrigger.Conditions&gt;
                              &lt;Condition  Property="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor}}" Value="True"/&gt;
                          &lt;/MultiDataTrigger.Conditions&gt;            
                          &lt;Setter Property="Foreground" Value="White"/&gt;
                      &lt;/MultiDataTrigger&gt;
                  &lt;/Style.Triggers&gt;
              &lt;/Style&gt;
  
              &lt;DataTemplate x:Key="appTemplate"&gt;
                  &lt;Label Style="{StaticResource GVLabelStyle}"
                         Content="{Binding ProcessInfo.ProcessName}"&gt;
                                 &lt;/Label&gt;
              &lt;/DataTemplate&gt;  
  
   &lt;ListView Background="Transparent"
                    Name="mainContentHolder"
                    ItemsSource="{Binding}"
                    BorderBrush="Transparent"
                    ItemContainerStyle="{StaticResource ListViewItemStyle}"&gt;
                  &lt;ListView.View&gt;
                  &lt;GridView ColumnHeaderContainerStyle="{StaticResource HeaderStyle}"&gt;
                      &lt;GridViewColumn Header="Application" 
                                      CellTemplate="{StaticResource appTemplate}"/&gt;
                      &lt;GridViewColumn Header="Window Title"
                                      CellTemplate="{StaticResource wndTemplate}"
                                      Width="300"/&gt;
                      &lt;GridViewColumn Header="Date"
                                      CellTemplate="{StaticResource dateTemplate}"/&gt;
  
                  &lt;/GridView&gt;
              &lt;/ListView.View&gt;
  
          &lt;/ListView&gt;
  </code></pre>