title: Style Triggers for Child Element in WPF
body: <p>I am writing a custom scrollbar. Upon mouse hover on grid(scrollbar), it should increase its height and the height of thumb and change the background etc. Everything is done except the height of thumb as thumb is a child element of grid instead of one of its property.</p>
  
  <p>This is the complete template code which is giving me exception that TargetName "ellipse" not found.</p>
  
  <pre><code>&lt;ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}"&gt;
      &lt;Grid MaxHeight="28"&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition MaxWidth="2"&gt;&lt;/ColumnDefinition&gt;
              &lt;ColumnDefinition Width="*"&gt;&lt;/ColumnDefinition&gt;
              &lt;ColumnDefinition MaxWidth="2"&gt;&lt;/ColumnDefinition&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Track Name="PART_Track" Grid.Column="1" IsDirectionReversed="False"&gt;
              &lt;Track.DecreaseRepeatButton&gt;
                  &lt;RepeatButton Command="ScrollBar.PageLeftCommand"
                      Style="{StaticResource ScrollBarPageButtonStyle}"&gt;
                  &lt;/RepeatButton&gt;
              &lt;/Track.DecreaseRepeatButton&gt;
              &lt;Track.Thumb&gt;
                  &lt;Thumb IsTabStop="False" Margin="0,1,0,1" BorderBrush="{StaticResource StandardBorderBrush}"&gt;
                      &lt;Thumb.Template&gt;
                          &lt;ControlTemplate TargetType="{x:Type Thumb}"&gt;
                              &lt;Rectangle Height="12" Name="ellipse"  Stroke="{StaticResource StandardBorderBrush}"
                                              Fill="{StaticResource StandardBrush}" RadiusX="5" RadiusY="5"&gt;&lt;/Rectangle&gt;
                          &lt;/ControlTemplate&gt;
                      &lt;/Thumb.Template&gt;                        
                  &lt;/Thumb&gt;                    
              &lt;/Track.Thumb&gt;
              &lt;Track.IncreaseRepeatButton&gt;
                  &lt;RepeatButton Command="ScrollBar.PageRightCommand"
                      Style="{StaticResource ScrollBarPageButtonStyle}"&gt;
                  &lt;/RepeatButton&gt;
              &lt;/Track.IncreaseRepeatButton&gt;
          &lt;/Track&gt;
          &lt;Grid.Resources&gt;
              &lt;Style TargetType="Grid"&gt;
                  &lt;Style.Triggers&gt;
                      &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                          &lt;Setter Property="Background" Value="Gray"&gt;&lt;/Setter&gt;
                          &lt;Setter TargetName="ellipse" Property="Height" Value="28"&gt;&lt;/Setter&gt;
                      &lt;/Trigger&gt;
                      &lt;Trigger Property="IsMouseOver" Value="False"&gt;
                          &lt;Setter Property="Background" Value="Transparent"&gt;&lt;/Setter&gt;
                          &lt;Setter TargetName="ellipse" Property="Height" Value="14"&gt;&lt;/Setter&gt;
                      &lt;/Trigger&gt;
                  &lt;/Style.Triggers&gt;
              &lt;/Style&gt;
          &lt;/Grid.Resources&gt;
      &lt;/Grid&gt;
  &lt;/ControlTemplate&gt;
  </code></pre>