title: How to highlight selected item in ItemsControl?
body: <p>I have the following XAML. How can i highlight the selected item in the ItemsControl ? I can override the selected item template for ListView but how to achieve the same for ItemsControl? Is there any alternative control that can display a collection of images ?</p>
  
  <pre><code>&lt;Window x:Class="ImageScrollDemo.View.MoviePosterView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="clr-namespace:ImageScrollDemo"
      xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
      Title="MoviePosterView" Height="367" Width="725" Foreground="White"&gt;
  &lt;Window.Background&gt;
      &lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1"&gt;
          &lt;GradientStop Color="#FF505050" Offset="0"/&gt;
          &lt;GradientStop Color="#FF202020" Offset="1"/&gt;
      &lt;/LinearGradientBrush&gt;
  &lt;/Window.Background&gt;
  &lt;Window.DataContext&gt;
      &lt;local:MainWindowViewModel /&gt;
  &lt;/Window.DataContext&gt;
  &lt;Window.Resources&gt;
      &lt;local:MainWindowViewModel x:Key="ViewModel" /&gt;
  
      &lt;Style TargetType="Image" x:Key="ImageHover"&gt;
          &lt;Style.Triggers&gt;
              &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                  &lt;Setter Property="Opacity" Value="1" /&gt;
                  &lt;Setter Property="BitmapEffect"&gt;
                      &lt;Setter.Value&gt;
                          &lt;OuterGlowBitmapEffect GlowColor="Gold" GlowSize="8"/&gt;
                      &lt;/Setter.Value&gt;
                  &lt;/Setter&gt;
              &lt;/Trigger&gt;
              &lt;Trigger Property="IsMouseOver" Value="False"&gt;
                  &lt;Setter Property="Opacity" Value="0.7" /&gt;
              &lt;/Trigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  &lt;/Window.Resources&gt;
  &lt;i:Interaction.Triggers&gt;
      &lt;i:EventTrigger EventName="Loaded"&gt;
          &lt;i:InvokeCommandAction Command="{Binding PopulateMovieGrid}" /&gt;
      &lt;/i:EventTrigger&gt;
  &lt;/i:Interaction.Triggers&gt;
  &lt;Grid&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="*" /&gt;
          &lt;RowDefinition Height="60" /&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto"&gt;
          &lt;ItemsControl Name="itemsCtrl" HorizontalContentAlignment="Center" ItemsSource="{Binding Path=MovieCollection, Mode=TwoWay}"&gt;
              &lt;ItemsControl.ItemsPanel&gt;
                  &lt;ItemsPanelTemplate&gt;
                      &lt;UniformGrid Columns="5" /&gt;
                  &lt;/ItemsPanelTemplate&gt;
              &lt;/ItemsControl.ItemsPanel&gt;
  
              &lt;ItemsControl.ItemContainerStyle&gt;
                  &lt;Style TargetType="ContentPresenter"&gt;
                      &lt;Setter Property="ContentTemplate"&gt;
                          &lt;Setter.Value&gt;
                              &lt;DataTemplate&gt;
                                  &lt;Border BorderBrush="Black" BorderThickness="5"&gt;
                                      &lt;ContentPresenter Content="{Binding}"/&gt;
                                  &lt;/Border&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/Setter.Value&gt;
                      &lt;/Setter&gt;
                  &lt;/Style&gt;
              &lt;/ItemsControl.ItemContainerStyle&gt;
              &lt;ItemsControl.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                          &lt;StackPanel Orientation="Vertical" HorizontalAlignment="Center"&gt;
                              &lt;Image Style="{StaticResource ImageHover}" Margin="0,5,0,0" RenderOptions.BitmapScalingMode="HighQuality" SnapsToDevicePixels="True" HorizontalAlignment="Center" Source="{Binding Path=Poster}" Height="150" /&gt;
                              &lt;TextBlock Name="txtTitle" FontSize="10" HorizontalAlignment="Center" TextAlignment="Justify" Text="{Binding Title}" TextWrapping="Wrap" MaxWidth="110" /&gt;
                          &lt;/StackPanel&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ItemsControl.ItemTemplate&gt;
          &lt;/ItemsControl&gt;
      &lt;/ScrollViewer&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>