title: How to change stroke of Ellipse when ListBox item is selected in Windows Phone 8?
body: <p>I am currently working on windows phone 8 and I have created a ListBox with Ellipse inside it to show images. Now I want to change the Stroke Colour for it when user selects any item in ListBox. My ListBox XAML code and its DataTemplate is below</p>
  
  <pre><code>&lt;ListBox x:Name="OwnerList"
           ScrollViewer.HorizontalScrollBarVisibility="Auto"
           ScrollViewer.VerticalScrollBarVisibility="Disabled"
           ItemsPanel="{StaticResource FileItemsPanel}"
           ItemTemplate="{StaticResource OwnerListTemplate}"
           SelectionMode="Multiple"
           SelectionChanged="OwnerList_SelectionChanged"/&gt;
  </code></pre>
  
  <p>DataTemplate</p>
  
  <pre><code>&lt;DataTemplate x:Key="OwnerListTemplate"&gt;
          &lt;StackPanel Margin="20,0,20,0"&gt;
              &lt;Ellipse Height="120"
                       Width="120"
                       Margin="4"
                       Stroke="Blue"
                       StrokeThickness="2"&gt;
                  &lt;Ellipse.Fill&gt;
                      &lt;ImageBrush ImageSource="{Binding PHOTO, Converter={StaticResource Imageconverter}}"/&gt;
                  &lt;/Ellipse.Fill&gt;
              &lt;/Ellipse&gt;
              &lt;TextBlock x:Name="OwnerName"
                         Text="{Binding NAME}"
                         FontSize="22"
                         Foreground="Gray"
                         FontWeight="Bold"
                         HorizontalAlignment="Center"
                         VerticalAlignment="Center"/&gt;
              &lt;TextBlock x:Name="distance"
                         Text="{Binding DISTANCE}"
                         FontSize="20"
                         Foreground="Gray"
                         HorizontalAlignment="Center"
                         VerticalAlignment="Center"/&gt;
          &lt;/StackPanel&gt;
      &lt;/DataTemplate&gt;
  
  
      &lt;ItemsPanelTemplate x:Key="FileItemsPanel"&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;StackPanel.RenderTransform&gt;
                  &lt;TranslateTransform X="0" /&gt;
              &lt;/StackPanel.RenderTransform&gt;
          &lt;/StackPanel&gt;
      &lt;/ItemsPanelTemplate&gt;
  </code></pre>
  
  <p>I know how to change foreground of an entire list item, but I am not aware how to change ellipse stroke colour.To change Foreground color for ListBox , I implemented below code</p>
  
  <pre><code>&lt;Style x:Key="DynamicDataGenericListViewContainerStyle"
         TargetType="ListBoxItem"&gt;
          &lt;Setter Property="HorizontalContentAlignment"
              Value="Stretch" /&gt;
          &lt;Setter Property="Margin"
              Value="0,0,0,1"/&gt;
          &lt;Setter Property="Padding"
              Value="0"/&gt;
  
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="ListBoxItem"&gt;
                      &lt;Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"&gt;
                          &lt;VisualStateManager.VisualStateGroups&gt;
                              &lt;VisualStateGroup x:Name="CommonStates"&gt;
                                  &lt;VisualState x:Name="Normal"/&gt;
                                  &lt;VisualState x:Name="MouseOver"/&gt;
                                  &lt;VisualState x:Name="Disabled"&gt;
                                      &lt;Storyboard&gt;
                                          &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot"&gt;
                                              &lt;DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/&gt;
                                          &lt;/ObjectAnimationUsingKeyFrames&gt;
                                          &lt;DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/&gt;
                                      &lt;/Storyboard&gt;
                                  &lt;/VisualState&gt;
                              &lt;/VisualStateGroup&gt;
                              &lt;VisualStateGroup x:Name="SelectionStates"&gt;
                                  &lt;VisualState x:Name="Unselected"/&gt;
                                  &lt;VisualState x:Name="Selected"&gt;
                                      &lt;Storyboard&gt;
                                          &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
                                  Storyboard.TargetProperty="BorderThickness"&gt;
                                              &lt;DiscreteObjectKeyFrame KeyTime="0" Value="0,0,0,2" /&gt;
                                          &lt;/ObjectAnimationUsingKeyFrames&gt;
                                          &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
                                  Storyboard.TargetProperty="BorderBrush"&gt;
                                              &lt;DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DynamicDataColor}" /&gt;
                                          &lt;/ObjectAnimationUsingKeyFrames&gt;
  
                                          &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer"&gt;
                                              &lt;DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DynamicDataColor}"/&gt;
                                          &lt;/ObjectAnimationUsingKeyFrames&gt;
                                      &lt;/Storyboard&gt;
                                  &lt;/VisualState&gt;
                              &lt;/VisualStateGroup&gt;
                          &lt;/VisualStateManager.VisualStateGroups&gt;
                          &lt;ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/&gt;
                      &lt;/Border&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
  
      &lt;/Style&gt;
  </code></pre>