<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
    xmlns="www.team-mediaportal.com/2008/mpf/directx"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:collections="clr-namespace:MediaPortal.UI.Presentation.DataObjects;assembly=MediaPortal.UI"
    xmlns:navitems="clr-namespace:MediaPortal.UiComponents.Media.Models.Navigation;assembly=Media"
    xmlns:mp_special_controls="clr-namespace:MediaPortal.UI.SkinEngine.SpecialElements.Controls;assembly=SkinEngine"
    xmlns:media="clr-namespace:MediaPortal.UiComponents.Media.Models.AspectWrappers;assembly=Media"
    xmlns:aspect="clr-namespace:MediaPortal.Common.MediaManagement.DefaultItemAspects;assembly=MediaPortal.Common"
    xmlns:fanart="clr-namespace:MediaPortal.Extensions.UserServices.FanArtService.Client;assembly=FanArtService.Client"
    DependsOnStyleResources="OSD,FullScreenContentConsts,MediaButtons,MediaColors,MediaConsts,Consts,Colors,Buttons,OtherControls,Widgets"
    >

  <Model x:Key="FanArtBackgroundModel" Id="8F42C8E9-E8A3-475C-A50A-99E1E644DC91"/>
  <Model x:Key="TimeModel" Id="E821B1C8-0666-4339-8027-AA45A4F6F107"/>

  <fanart:MediaItemAspectToBoolConverter x:Key="MediaItemAspectToBoolConverter" />

  <!-- ***************************************** OSD ************************************************** -->
  <Storyboard x:Key="OSDCurrentPlayerControlStoryboard" FillBehavior="Stop">
    <!-- TODO: nicer background cycle effect -->
    <ColorAnimationUsingKeyFrames RepeatBehavior="Forever" AutoReverse="true" BeginTime="00:00:00"
        Storyboard.TargetName="OSDInfoArea" Storyboard.TargetProperty="Fill.GradientStops[0].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource OSDCurrentPlayerControlBackgroundColor1}"/>
    </ColorAnimationUsingKeyFrames>
    <!--<ColorAnimationUsingKeyFrames RepeatBehavior="Forever" AutoReverse="true" BeginTime="00:00:00"
        Storyboard.TargetName="OSDInfoArea" Storyboard.TargetProperty="Fill.GradientStops[1].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource OSDCurrentPlayerControlBackgroundColor2}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames RepeatBehavior="Forever" AutoReverse="true" BeginTime="00:00:00"
        Storyboard.TargetName="OSDInfoArea" Storyboard.TargetProperty="Fill.GradientStops[2].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource OSDCurrentPlayerControlBackgroundColor3}"/>
    </ColorAnimationUsingKeyFrames>-->
  </Storyboard>

  <Style x:Key="PrimaryVideoOSDStyle" TargetType="{x:Type mp_special_controls:PlayerControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type mp_special_controls:PlayerControl}">
          <ControlTemplate.Resources>
            <Model x:Key="VideoPlayerModel" Id="4E2301B4-3C17-4a1d-8DE5-2CEA169A0256"/>
          </ControlTemplate.Resources>

          <Control Style="{ThemeResource OSDContainer}" Width="{ThemeResource FullScreenContentVideoPrimaryPlayerOSDWidth}" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
            <Control.Resources>
              <ControlTemplate x:Key="OSD_InfoArea_Template">

                <Grid x:Name="PlayerGrid" Margin="10,0,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="180"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="180"/>
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                  </Grid.RowDefinitions>

                  <media:MovieAspectWrapper MediaItem="{Binding Path=MediaItem}" HorizontalAlignment="Left"
                                            Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" Margin="0,10,0,0">
                    <media:MovieAspectWrapper.IsVisible>
                      <MultiBinding Converter="{StaticResource MediaItemAspectToBoolConverter}">
                        <Binding Path="MediaItem" />
                        <Binding Source="{x:Static aspect:MovieAspect.ASPECT_ID}" />
                      </MultiBinding>
                    </media:MovieAspectWrapper.IsVisible>
                    <media:MovieAspectWrapper.Template>
                      <ControlTemplate>
                        <Image Height="150" Stretch="Uniform"
                               Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MediaItem}"/>
                      </ControlTemplate>
                    </media:MovieAspectWrapper.Template>
                  </media:MovieAspectWrapper>

                  <media:SeriesAspectWrapper MediaItem="{Binding Path=MediaItem}" HorizontalAlignment="Left"
                                             Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" Margin="0,10,0,0">
                    <media:SeriesAspectWrapper.IsVisible>
                      <MultiBinding Converter="{StaticResource MediaItemAspectToBoolConverter}">
                        <Binding Path="MediaItem" />
                        <Binding Source="{x:Static aspect:SeriesAspect.ASPECT_ID}" />
                      </MultiBinding>
                    </media:SeriesAspectWrapper.IsVisible>
                    <media:SeriesAspectWrapper.Template>
                      <ControlTemplate>
                        <Image Stretch="Uniform" Height="150"
                               FallbackSource="VideoLarge.png">
                          <Image.Source>
                            <fanart:FanArtImageSource fanart:FanArtMediaType="Series" fanart:FanArtType="Poster"
                                    fanart:FanArtName="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SeriesName}"
                                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
                          </Image.Source>
                        </Image>
                      </ControlTemplate>
                    </media:SeriesAspectWrapper.Template>
                  </media:SeriesAspectWrapper>

                  <DockPanel Grid.Column="1" Grid.Row="0" LastChildFill="true" Margin="3">
                    <Grid DockPanel.Dock="Center">
                      <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                      </Grid.ColumnDefinitions>
                      <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                      </Grid.RowDefinitions>
                      <Label x:Name="VideoName" Content="{Binding Path=MediaItemTitle}" Color="{ThemeResource TextColor}"
                          FontSize="{ThemeResource OsdTitleFontSize}" FontFamily="TitanBold"
                          Scroll="Auto" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                    </Grid>
                  </DockPanel>
                  <!--Rectangle Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" RadiusX="20" RadiusY="20" Fill="#80000000" /-->
                  <Label x:Name="TimeLabel" Color="#FF66b1d8" FontSize="{ThemeResource BigFontSize}"
                        HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" 
                        Content="{Binding Source={StaticResource TimeModel}, Path=CurrentTime}" />
                </Grid>
              </ControlTemplate>

              <ControlTemplate x:Key="OSD_Progress_Template">
                <DockPanel LastChildFill="true" Margin="10,-5,10,-5">
                  <Grid DockPanel.Dock="Center" HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="Auto"/>
                      <ColumnDefinition Width="*"/>
                      <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                      <RowDefinition Height="15"/>
                      <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <!--Label x:Name="PlayerStateLabel" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center"
                        Content="{Binding PlayerStateText}" Scroll="Auto" FontSize="{ThemeResource SmallFontSize}"
                        Color="{ThemeResource TextColor}" /-->

                    <Label x:Name="CurrentTimeLabel" Grid.Column="1" Grid.Row="1"  Content="{Binding CurrentTime}" FontSize="{ThemeResource SmallFontSize}"
                        Color="{ThemeResource TextColor}"  Margin="0,0,0,0" HorizontalAlignment="Right" VerticalAlignment="Center"/>

                    <ProgressBar x:Name="ProgressBar" Grid.Row="1" Grid.Column="2" Height="12" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="15,5,15,0"
                        Value="{Binding Path=PercentPlayed}" />

                    <Label x:Name="VideoDurationLabel" Grid.Column="3" Grid.Row="1" Margin="0,0,0,0"
                        Content="{Binding Duration}"  FontSize="{ThemeResource SmallFontSize}"
                        HorizontalAlignment="Left" VerticalAlignment="Center"
                        Color="{ThemeResource TextColor}"/>
                  </Grid>
                  <!-- PlayerGrid -->
                </DockPanel>
              </ControlTemplate>
              
              <ControlTemplate x:Key="OSD_Controls_Template">
                <StackPanel x:Name="PlayControlsPanel" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
                  <!-- Morpheus_xx: we want to see buttons always, not only when using mouse // IsVisible="{Binding ShowMouseControls}" -->
                  <Button x:Name="SkipBackButton" Style="{ThemeResource SkipBackButtonStyle}" IsVisible="{Binding CanSkipBack}"
                          Command="{Command Previous}"/>
                  <Button x:Name="RewindButton" Style="{ThemeResource RewindButtonStyle}" IsVisible="{Binding CanSeekBackward}"
                          Command="{Command SeekBackward}"/>
                  <Button x:Name="PlayButton" Style="{ThemeResource PlayButtonStyle}" IsVisible="{Binding CanPlay}"
                          Command="{Command Play}"/>
                  <Button x:Name="PauseButton" Style="{ThemeResource PauseButtonStyle}" IsVisible="{Binding CanPause}"
                          Command="{Command Pause}"/>
                  <Button x:Name="StopButton" Style="{ThemeResource StopButtonStyle}" IsVisible="{Binding CanStop}"
                          Command="{Command Stop}"/>
                  <Button x:Name="ForwardButton" Style="{ThemeResource ForwardButtonStyle}" IsVisible="{Binding CanSeekForward}"
                          Command="{Command SeekForward}"/>
                  <Button x:Name="SkipForwardButton" Style="{ThemeResource SkipForwardButtonStyle}" IsVisible="{Binding CanSkipForward}"
                          Command="{Command Next}"/>
                  <Image Source="topbar_devider.png" Margin="15,0,15,0"/>
                  <Button x:Name="SelectTitleButton" Style="{ThemeResource ShowDvdMenuButtonStyle}" Margin="0,0,0,0"
                          IsVisible="{Binding Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor.TitlesAvailable}"
                          Command="{Command Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor.OpenChooseTitleDialog}"/>
                  <Button x:Name="PreviousChapterButton" Style="{ThemeResource PreviousChapterButtonStyle}" Margin="0,0,0,0"
                          IsVisible="{Binding Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor.ChaptersAvailable}"
                          Command="{Command Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor.PrevChapter}"/>
                  <Button x:Name="SelectChapterButton" Style="{ThemeResource SelectChapterButtonStyle}" Margin="0,0,0,0"
                          IsVisible="{Binding Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor.ChaptersAvailable}"
                          Command="{Command Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor.OpenChooseChapterDialog}"/>
                  <Button x:Name="NextChapterButton" Style="{ThemeResource NextChapterButtonStyle}" Margin="0,0,0,0"
                          IsVisible="{Binding Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor.ChaptersAvailable}"
                          Command="{Command Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor.NextChapter}"/>
                  <Button x:Name="SelectSubtitleButton" Style="{ThemeResource SelectSubtitleButtonStyle}" Margin="0,0,0,0"
                          IsVisible="{Binding Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor.SubtitlesAvailable}"
                          Command="{Command Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor.OpenChooseSubtitleDialog}"/>       
                  <Button x:Name="Audio" Style="{ThemeResource AudioActiveButtonStyle}" Margin="0,0,0,0" IsVisible="{Binding IsAudio}"
                          Command="{Command AudioButtonPressed}"/>
                  <Image Source="topbar_devider.png" Margin="15,0,15,0"/>
                  <Button x:Name="BackButton" Style="{ThemeResource NavigateBackButtonStyle}" Margin="0,0,0,0"
                          Command="{Command Source={Service WorkflowManager},Path=NavigatePop,Parameters=1}"/>
                  <Button x:Name="PowerButton" Style="{ThemeResource PowerButtonStyle}" Margin="0,0,0,0"
                          Command="{Command Source={Service WorkflowManager},Path=NavigatePush,Parameters=BBFA7DB7-5055-48D5-A904-0F0C79849369}"/>
                </StackPanel>
                
                <!-- PlayControlsPanel -->
              </ControlTemplate>
            </Control.Resources>
          </Control>
          <ControlTemplate.Triggers>
            <Trigger Property="IsCurrentPlayer" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="CurrentPlayer_BeginStoryboard" Storyboard="{ThemeResource OSDCurrentPlayerControlStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="CurrentPlayer_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="PlayerContext" Value="PrimaryPlayer"/>
  </Style>

  <Style x:Key="PrimaryDvdOSDStyle" TargetType="{x:Type mp_special_controls:PlayerControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type mp_special_controls:PlayerControl}">
          <ControlTemplate.Resources>
            <Model x:Key="VideoPlayerModel" Id="4E2301B4-3C17-4a1d-8DE5-2CEA169A0256"/>
          </ControlTemplate.Resources>

          <Control Style="{ThemeResource OSDContainer}" Width="{ThemeResource FullScreenContentVideoPrimaryPlayerOSDWidth}" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
            <Control.Resources>
              <ControlTemplate x:Key="OSD_InfoArea_Template">

                <Grid x:Name="PlayerGrid" Margin="10,0,10,0"
                HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="180"/>
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                  </Grid.RowDefinitions>
                  <DockPanel Grid.Column="0" Grid.Row="0" LastChildFill="true" Margin="3">

                    <Grid DockPanel.Dock="Center">
                      <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                      </Grid.ColumnDefinitions>
                      <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                      </Grid.RowDefinitions>
                      <Label x:Name="VideoName" Content="{Binding Path=MediaItemTitle}" Color="{ThemeResource TextColor}"
                          FontSize="{ThemeResource OsdTitleFontSize}" FontFamily="TitanBold"
                          Scroll="Auto" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                    </Grid>
                  </DockPanel>

                  <Rectangle Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" RadiusX="20" RadiusY="20" Fill="#80000000" />

                  <Label x:Name="TimeLabel" Color="#FF66b1d8" FontSize="{ThemeResource BigFontSize}"
                        HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" 
                        Content="{Binding Source={StaticResource TimeModel}, Path=CurrentTime}" />

                </Grid>
              </ControlTemplate>

              <ControlTemplate x:Key="OSD_Progress_Template">

                <DockPanel LastChildFill="true" Margin="3">
                  <Grid DockPanel.Dock="Center" HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="200"/>
                      <ColumnDefinition Width="150"/>
                      <ColumnDefinition Width="*"/>
                      <ColumnDefinition Width="350"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                      <RowDefinition Height="15"/>
                      <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <Label x:Name="PlayerStateLabel" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left"
                        Content="{Binding PlayerStateText}" Scroll="Auto"
                        Color="{ThemeResource ProgressBarTextColor}" />

                    <Label x:Name="CurrentTimeLabel" Grid.Column="1" Grid.Row="1"  Content="{Binding CurrentTime}"
                        Color="{ThemeResource ProgressBarTextColor}"  Margin="0,0,20,0" HorizontalAlignment="Right"/>

                    <ProgressBar x:Name="ProgressBar" Grid.Row="1" Grid.Column="2" Height="22" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0,5,0,0"
                        Value="{Binding Path=PercentPlayed}" />

                    <Label x:Name="VideoDurationLabel" Grid.Column="3" Grid.Row="1" Margin="20,0,0,0"
                        Content="{Binding Duration}" 
                        HorizontalAlignment="Left" VerticalAlignment="Center"
                        Color="{ThemeResource ProgressBarTextColor}"/>

                  </Grid>
                  <!-- PlayerGrid -->
                </DockPanel>
              </ControlTemplate>

              <ControlTemplate x:Key="OSD_Controls_Template">
                <StackPanel x:Name="PlayControlsPanel" Orientation="Horizontal" 
                  VerticalAlignment="Center" HorizontalAlignment="Center">
                  <!-- Morpheus_xx: we want to see buttons always, not only when using mouse // IsVisible="{Binding ShowMouseControls}" -->
                  <Button x:Name="SkipBackButton" Style="{ThemeResource SkipBackButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanSkipBack}"
                    Command="{Command Previous}"/>
                  <Button x:Name="RewindButton" Style="{ThemeResource RewindButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanSeekBackward}"
                    Command="{Command SeekBackward}"/>
                  <Button x:Name="PlayButton" Style="{ThemeResource PlayButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanPlay}"
                    Command="{Command Play}"/>
                  <Button x:Name="PauseButton" Style="{ThemeResource PauseButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanPause}"
                    Command="{Command Pause}"/>
                  <Button x:Name="StopButton" Style="{ThemeResource StopButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanStop}"
                    Command="{Command Stop}"/>
                  <Button x:Name="ForwardButton" Style="{ThemeResource ForwardButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanSeekForward}"
                    Command="{Command SeekForward}"/>
                  <Button x:Name="SkipForwardButton" Style="{ThemeResource SkipForwardButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanSkipForward}"
                    Command="{Command Next}"/>

                  <!-- DVD specific feature buttons -->
                  <StackPanel x:Name="DvdButtons" Orientation="Horizontal" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                    DataContext="{Binding Source={StaticResource VideoPlayerModel},Path=PlayerUIContributor}">
                    <Button x:Name="ShowDvdMenuButton" Style="{ThemeResource ShowDvdMenuButtonStyle}" Margin="5,0,5,0" 
                      Command="{Command ShowDvdMenu}"/>
                    <Button x:Name="PreviousChapterButton" Style="{ThemeResource PreviousChapterButtonStyle}" Margin="5,0,5,0" 
                      IsVisible="{Binding ChaptersAvailable}"
                      Command="{Command PrevChapter}"/>
                    <Button x:Name="SelectChapterButton" Style="{ThemeResource SelectChapterButtonStyle}" Margin="5,0,5,0" 
                      IsVisible="{Binding ChaptersAvailable}"
                      Command="{Command OpenChooseChapterDialog}"/>
                    <Button x:Name="NextChapterButton" Style="{ThemeResource NextChapterButtonStyle}" Margin="5,0,5,0" 
                      IsVisible="{Binding ChaptersAvailable}"
                      Command="{Command NextChapter}"/>
                    <Button x:Name="SelectSubtitleButton" Style="{ThemeResource SelectSubtitleButtonStyle}" Margin="5,0,5,0" 
                      IsVisible="{Binding SubtitlesAvailable}"
                      Command="{Command OpenChooseSubtitleDialog}"/>
                  </StackPanel>
                  <!-- DvdButtons -->

                  <Grid x:Name="AudioPanel" DockPanel.Dock="Right" HorizontalAlignment="Right" Margin="4,0,0,0">
                    <Grid x:Name="Audio_NoMouse" IsVisible="{Binding !ShowMouseControls}"
                      VerticalAlignment="Center" HorizontalAlignment="Center">
                      <!-- Must be located the same as Audio_Mouse -->
                      <Control x:Name="AudioSimple" IsVisible="{Binding IsAudio}" Template="{ThemeResource AudioActiveControlTemplate}"/>
                      <Control x:Name="MuteOnOffSimple" Template="{ThemeResource MuteOnOffControlTemplate}">
                        <Control.IsVisible>
                          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                            <Binding Path="IsAudio"/>
                            <Binding Path="IsMuted"/>
                          </MultiBinding>
                        </Control.IsVisible>
                      </Control>
                    </Grid>
                    <Grid x:Name="Audio_Mouse" IsVisible="{Binding ShowMouseControls}"
                      VerticalAlignment="Center" HorizontalAlignment="Center">
                      <!-- Must be located the same as Audio_NoMouse -->
                      <Button x:Name="AudioActiveButton" IsVisible="{Binding IsAudio}" Style="{ThemeResource AudioActiveButtonStyle}"
                        Command="{Command AudioButtonPressed}"/>
                      <Button x:Name="AudioInactiveButton" IsVisible="{Binding !IsAudio}" Style="{ThemeResource AudioInactiveButtonStyle}"
                        Command="{Command AudioButtonPressed}"/>
                    </Grid>
                  </Grid>
                </StackPanel>
                <!-- PlayControlsPanel -->
              </ControlTemplate>

            </Control.Resources>
          </Control>
          <ControlTemplate.Triggers>
            <Trigger Property="IsCurrentPlayer" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="CurrentPlayer_BeginStoryboard" Storyboard="{ThemeResource OSDCurrentPlayerControlStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="CurrentPlayer_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="PlayerContext" Value="PrimaryPlayer"/>
  </Style>

  <Style x:Key="PrimaryImageOSDStyle" TargetType="{x:Type mp_special_controls:PlayerControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type mp_special_controls:PlayerControl}">

          <Control Style="{ThemeResource OSDContainer}" Width="{ThemeResource FullScreenContentVideoPrimaryPlayerOSDWidth}" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
            <Control.Resources>
              <ControlTemplate x:Key="OSD_InfoArea_Template">

                <DockPanel x:Name="HeadLine" Grid.Row="0" Grid.Column="0" LastChildFill="True">
                  <Label x:Name="ImageName" DockPanel.Dock="Center" Margin="3" Content="{Binding Path=MediaItemTitle}" Scroll="Auto"
                    Color="{ThemeResource TextColor}" HorizontalAlignment="Left" VerticalAlignment="Center"
                    FontSize="{ThemeResource OsdTitleFontSize}" FontFamily="TitanBold" />
                </DockPanel>
                <!-- HeadLine -->
              </ControlTemplate>

              <ControlTemplate x:Key="OSD_Progress_Template">
              </ControlTemplate>

              <ControlTemplate x:Key="OSD_Controls_Template">
                <StackPanel x:Name="PlayControlsPanel" Orientation="Horizontal" 
                  VerticalAlignment="Center" HorizontalAlignment="Center">
                  <!-- Morpheus_xx: we want to see buttons always, not only when using mouse // IsVisible="{Binding ShowMouseControls}" -->
                  <Button x:Name="SkipBackButton" Style="{ThemeResource SkipBackButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanSkipBack}"
                    Command="{Command Previous}"/>
                  <Button x:Name="PlayButton" Style="{ThemeResource PlayButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanPlay}"
                    Command="{Command Play}"/>
                  <Button x:Name="PauseButton" Style="{ThemeResource PauseButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanPause}"
                    Command="{Command Pause}"/>
                  <Button x:Name="StopButton" Style="{ThemeResource StopButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanStop}"
                    Command="{Command Stop}"/>
                  <Button x:Name="SkipForwardButton" Style="{ThemeResource SkipForwardButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanSkipForward}"
                    Command="{Command Next}"/>

                  <Button x:Name="AudioActiveButton" IsVisible="{Binding IsAudio}" Style="{ThemeResource AudioActiveButtonStyle}"
                        Command="{Command AudioButtonPressed}"/>
                </StackPanel>
                <!-- PlayControlsPanel -->
              </ControlTemplate>
            </Control.Resources>
          </Control>
          <ControlTemplate.Triggers>
            <Trigger Property="IsCurrentPlayer" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="CurrentPlayer_BeginStoryboard" Storyboard="{ThemeResource OSDCurrentPlayerControlStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="CurrentPlayer_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="PlayerContext" Value="PrimaryPlayer"/>
  </Style>

  <Storyboard x:Key="PressedPiPOSDButtonStoryboard" FillBehavior="HoldEnd">
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="Forever" AutoReverse="True" Storyboard.TargetName="PiPControlBorder" Storyboard.TargetProperty="BorderBrush.Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource PipBorderColor}"/>
      <SplineColorKeyFrame KeyTime="{ThemeResource PressedPiPOSDButtonAnimationTime2}" Value="{ThemeResource OSDPipBorderFocusColor}"/>
    </ColorAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="PiPButton" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
      <SplineDoubleKeyFrame KeyTime="{ThemeResource PressedPiPOSDButtonAnimationTime1}" Value="{ThemeResource SquareButtonZoomCoefficient}"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="PiPButton" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
      <SplineDoubleKeyFrame KeyTime="{ThemeResource PressedPiPOSDButtonAnimationTime1}" Value="{ThemeResource SquareButtonZoomCoefficient}"/>
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>

  <Style x:Key="SecondaryMediaOSDStyle" TargetType="{x:Type mp_special_controls:PlayerControl}">
    <Setter Property="FixedImageHeight" Value="{ThemeResource FullScreenContentVideoSecondaryPlayerOSDPipHeight}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type mp_special_controls:PlayerControl}">
          <Border x:Name="OSD_Background" BorderBrush="{ThemeResource OSDPlayControlBorderColor}"
              CornerRadius="{ThemeResource OSDPlayControlCornerRadius}" BorderThickness="{ThemeResource OSDPlayControlBorderThickness}"
              DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
              Margin="0,0,20,0">
            <Border.Background>
              <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                <GradientStop Offset="0" Color="{ThemeResource OSDPlayerControlBackgroundColor1}"/>
                <GradientStop Offset="0.5" Color="{ThemeResource OSDPlayerControlBackgroundColor2}"/>
                <GradientStop Offset="1" Color="{ThemeResource OSDPlayerControlBackgroundColor3}"/>
              </LinearGradientBrush >
            </Border.Background>
            <Grid x:Name="PlayerGrid" Grid.Column="2" Grid.Row="0" Margin="10,0,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
              </Grid.ColumnDefinitions>
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
              </Grid.RowDefinitions>
              <DockPanel x:Name="PiPHeaderPanel" Grid.Column="0" Grid.Row="0" LastChildFill="true" Margin="3">
                <Grid x:Name="AudioPanel" DockPanel.Dock="Right" HorizontalAlignment="Right" Margin="4,0,0,0" IsVisible="{Binding HasAudio}">
                  <Grid x:Name="Audio_NoMouse" IsVisible="{Binding !ShowMouseControls}" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <!-- Must be located the same as Audio_Mouse -->
                    <Control x:Name="AudioSimple" IsVisible="{Binding IsAudio}" Template="{ThemeResource AudioActiveControlTemplate}"/>
                    <Control x:Name="MuteOnOffSimple" Template="{ThemeResource MuteOnOffControlTemplate}">
                      <Control.IsVisible>
                        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                          <Binding Path="IsAudio"/>
                          <Binding Path="IsMuted"/>
                        </MultiBinding>
                      </Control.IsVisible>
                    </Control>
                  </Grid>
                  <Grid x:Name="Audio_Mouse" IsVisible="{Binding ShowMouseControls}" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <!-- Must be located the same as Audio_NoMouse -->
                    <Button x:Name="AudioActiveButton" IsVisible="{Binding IsAudio}" Style="{ThemeResource AudioActiveButtonStyle}"
                      Command="{Command AudioButtonPressed}"/>
                    <Button x:Name="AudioInactiveButton" IsVisible="{Binding !IsAudio}" Style="{ThemeResource AudioInactiveButtonStyle}"
                      Command="{Command AudioButtonPressed}"/>
                  </Grid>
                  <Grid.LayoutTransform>
                    <TransformGroup>
                      <ScaleTransform ScaleX="0.6" ScaleY="0.6"/>
                    </TransformGroup>
                  </Grid.LayoutTransform>
                </Grid>
                <Grid DockPanel.Dock="Center">
                  <!-- Has to be last control in DockPanel, LastChildFill! -->
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                  </Grid.RowDefinitions>
                  <Label x:Name="MediaName" Content="{Binding Path=MediaItemTitle}" Color="{ThemeResource TextColor}" Scroll="Auto"
                    HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{ThemeResource SmallFontSize}"
                    MaxWidth="{ThemeResource FullScreenContentVideoSecondaryPlayerOSDTextMaxWidth}"/>
                </Grid>
              </DockPanel>
              <!-- PiPHeaderPanel -->
              <Button x:Name="PiPButton" Grid.Column="0" Grid.Row="1" Margin="5"
                Style="{ThemeResource PipControlStyle}" RenderTransformOrigin="0.5,0.5"
                VerticalAlignment="Center" HorizontalAlignment="Center"
                Command="{Command SwitchPip}" IsVisible="{Binding IsPip}">
                <Button.RenderTransform>
                  <TransformGroup>
                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                  </TransformGroup>
                </Button.RenderTransform>
                <Button.Triggers>
                  <Trigger Property="HasFocus" Value="True">
                    <Trigger.EnterActions>
                      <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource PressedPiPOSDButtonStoryboard}"/>
                    </Trigger.EnterActions>
                    <Trigger.ExitActions>
                      <StopStoryboard BeginStoryboardName="Focused_BeginStoryboard"/>
                    </Trigger.ExitActions>
                  </Trigger>
                </Button.Triggers>
              </Button>
              <!-- PiPButton -->
              <Label x:Name="PlayerStateLabel" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Center" Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallerFontSize}"
                Content="{Binding PlayerStateText}" Scroll="Auto" MaxWidth="{ThemeResource FullScreenContentVideoSecondaryPlayerOSDTextMaxWidth}"/>

              <StackPanel x:Name="PlayControlsPanel" Orientation="Horizontal" Grid.Column="0" Grid.Row="3" Margin="10,10,10,0"
                VerticalAlignment="Center" HorizontalAlignment="Center" IsVisible="{Binding ShowMouseControls}" >
                <Button x:Name="SkipBackButton" Style="{ThemeResource SkipBackButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanSkipBack}"
                  Command="{Command Previous}"/>
                <Button x:Name="RewindButton" Style="{ThemeResource RewindButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanSeekBackward}"
                  Command="{Command SeekBackward}"/>
                <Button x:Name="PlayButton" Style="{ThemeResource PlayButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanPlay}"
                  Command="{Command Play}"/>
                <Button x:Name="PauseButton" Style="{ThemeResource PauseButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanPause}"
                  Command="{Command Pause}"/>
                <Button x:Name="StopButton" Style="{ThemeResource StopButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanStop}"
                  Command="{Command Stop}"/>
                <Button x:Name="ForwardButton" Style="{ThemeResource ForwardButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanSeekForward}"
                  Command="{Command SeekForward}"/>
                <Button x:Name="SkipForwardButton" Style="{ThemeResource SkipForwardButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanSkipForward}"
                  Command="{Command Next}"/>
                <!--StackPanel.LayoutTransform>
                  <TransformGroup>
                    <ScaleTransform ScaleX="0.6" ScaleY="0.6"/>
                  </TransformGroup>
                </StackPanel.LayoutTransform-->
              </StackPanel>
              <!-- PlayControlsPanel -->
            </Grid>
            <!-- PlayerGrid -->
          </Border>
          <!-- OSD_Background -->
          <ControlTemplate.Triggers>
            <Trigger Property="IsCurrentPlayer" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="CurrentPlayer_BeginStoryboard" Storyboard="{ThemeResource OSDCurrentPlayerControlStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="CurrentPlayer_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="PlayerContext" Value="SecondaryPlayer"/>
  </Style>

  <!-- 
    Media Navigation styles.
    We provide different control styles for thumbnail list and grid views for each navigation item (filter, audio, video,...).
  -->
  <Model x:Key="ViewModeModel" Id="6997CD35-63F0-4F96-8997-E18C9382E2DC"/>

  <!-- Fallback data template, if data template for actual item type is not defined -->
  <DataTemplate DataType="{x:Type navitems:NavigationItem}">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Label x:Name="ItemLabel" Grid.Column="0" Content="{Binding SimpleTitle}"
          Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}"/>
      <Label x:Name="NumItems" Grid.Column="1" Content="{Binding NumItems}"
          Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}"/>
    </Grid>
  </DataTemplate>

  <!-- Filter -->
  <ControlTemplate x:Key="ListViewFilterItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>
      <DockPanel LastChildFill="True" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Margin="0,0,4,0">
        <Image x:Name="ItemTypeSmall" Stretch="Uniform"
            Source="defaultFolder.png" Width="{StaticResource MEDIA_THUMB_WIDTH_S}" Height="{StaticResource MEDIA_THUMB_HEIGHT_S}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Small}"/>
          </Image.IsVisible>
        </Image>
        <Image x:Name="ItemTypeMedium" Stretch="Uniform"
            Source="defaultFolder.png" Width="{StaticResource MEDIA_THUMB_WIDTH_M}" Height="{StaticResource MEDIA_THUMB_HEIGHT_M}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Medium}"/>
          </Image.IsVisible>
        </Image>
        <Image x:Name="ItemTypeLarge" Stretch="Uniform"
            Source="defaultFolder.png" Width="{StaticResource MEDIA_THUMB_WIDTH_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Large}"/>
          </Image.IsVisible>
        </Image>
      </DockPanel>
      <Label x:Name="ItemLabel" Grid.Row="0" Grid.Column="1" Content="{Binding SimpleTitle}"
          Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}"/>
      <Label x:Name="NumItems" Grid.Row="0" Grid.Column="2" Content="{Binding NumItems}" Margin="0,0,15,0"
          Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}"/>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="GridViewFilterItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource GRIDVIEW_FILTER_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource GRIDVIEW_FILTER_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="ItemTypeImage" Grid.Row="0" Grid.Column="0" Stretch="Uniform" Margin="40" Source="defaultFolder.png"
             Width="{StaticResource MEDIA_THUMB_WIDTH_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}"/>
      <Label x:Name="NumItems" Grid.Row="0" Grid.Column="2" Content="{Binding NumItems}" Margin="0,0,0,0"
             Color="Black" FontSize="{ThemeResource TinyFontSize}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
      <Label x:Name="ItemLabel" Grid.Row="0" Grid.Column="0" Content="{Binding SimpleTitle}" Color="{ThemeResource TextColor}" Margin="0,0,0,10"
             FontSize="{ThemeResource SmallFontSize}" HorizontalAlignment="Center" VerticalAlignment="Bottom" />
      <Image Grid.Row="0" Grid.Column="0" Source="episode_thumb_focus.png" HorizontalAlignment="Center" 
             VerticalAlignment="Center" Stretch="Fill" Margin="-2" Width="{StaticResource GRIDVIEW_FILTER_WIDTH}" Height="{StaticResource GRIDVIEW_FILTER_WIDTH}"
       IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="CoverViewFilterItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource COVERVIEW_FILTER_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource COVERVIEW_FILTER_HEIGHT}"/>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>

      <Control x:Name="CoverReflexion" Style="{ThemeResource ReflexionControl}" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">
        <Control.Resources>
          <ResourceWrapper x:Key="ControlWidth" Resource="{StaticResource REFLEXION_WIDTH}"/>
          <ResourceWrapper x:Key="ControlHeight" Resource="{StaticResource REFLEXION_HEIGHT}"/>
          <ControlTemplate x:Key="MakeReflexion">
            <Image x:Name="ItemTypeImage" Stretch="Uniform" Margin="0,0,0,0" Source="defaultFolder.png"
              Width="{StaticResource MEDIA_THUMB_WIDTH_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}"/>
          </ControlTemplate>
        </Control.Resources>
      </Control>
      <Label x:Name="NumItems" Grid.Row="0" Grid.Column="0" Content="{Binding NumItems}" Margin="0,0,0,30"
                  Color="Black" FontSize="{ThemeResource TinyFontSize}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
      <Label x:Name="ItemLabel" Grid.Row="1" Grid.Column="0" Content="{Binding SimpleTitle}" HorizontalAlignment="Center"
          Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}"/>
    </Grid>
  </ControlTemplate>

  <!-- Container -->
  <ControlTemplate x:Key="ListViewContainerItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>
      <DockPanel LastChildFill="True" Grid.Row="0" Grid.Column="0"  Margin="0,0,4,0">
        <Image x:Name="ItemTypeSmall" Stretch="Uniform"
            Source="defaultFolder.png" Width="{StaticResource MEDIA_THUMB_WIDTH_S}" Height="{StaticResource MEDIA_THUMB_HEIGHT_S}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Small}"/>
          </Image.IsVisible>
        </Image>
        <Image x:Name="ItemTypeMedium" Stretch="Uniform"
            Source="defaultFolder.png" Margin="15" MaxWidth="{StaticResource MEDIA_THUMB_WIDTH_M}" MaxHeight="{StaticResource MEDIA_THUMB_HEIGHT_M}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Medium}"/>
          </Image.IsVisible>
        </Image>
        <Image x:Name="ItemTypeLarge" Stretch="Uniform"
            Source="defaultFolder.png" Margin="15" MaxWidth="{StaticResource MEDIA_THUMB_WIDTH_L}" MaxHeight="{StaticResource MEDIA_THUMB_HEIGHT_L}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Large}"/>
          </Image.IsVisible>
        </Image>
      </DockPanel>
      <Label x:Name="ItemLabel" Grid.Row="0" Grid.Column="1" Content="{Binding SimpleTitle}"
          Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}" VerticalAlignment="Center"/>
      <Label x:Name="NumItems" Grid.Row="0" Grid.Column="2" Content="{Binding NumItems}" Margin="0,0,15,0"
          Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}" VerticalAlignment="Center"/>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="GridViewContainerItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource GRIDVIEW_FILTER_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource GRIDVIEW_FILTER_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="ItemTypeImage" Grid.Row="0" Grid.Column="0" Stretch="Uniform" Margin="40" Source="defaultFolder.png"
           Width="{StaticResource MEDIA_THUMB_WIDTH_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}"/>
      <Label x:Name="ItemLabel" Grid.Row="0" Grid.Column="0" Content="{Binding SimpleTitle}" Color="{ThemeResource TextColor}" Margin="0,0,0,10"
           FontSize="{ThemeResource SmallFontSize}" HorizontalAlignment="Center" VerticalAlignment="Bottom" />
      <Image Grid.Row="0" Grid.Column="0" Source="episode_thumb_focus.png" HorizontalAlignment="Center"
             VerticalAlignment="Center" Stretch="Fill" Margin="-2" Width="{StaticResource GRIDVIEW_FILTER_WIDTH}" Height="{StaticResource GRIDVIEW_FILTER_WIDTH}"
       IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="CoverViewContainerItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource COVERVIEW_FILTER_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource COVERVIEW_FILTER_HEIGHT}"/>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>

      <Control x:Name="CoverReflexion" Style="{ThemeResource ReflexionControl}" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">
        <Control.Resources>
          <ResourceWrapper x:Key="ControlWidth" Resource="{StaticResource REFLEXION_WIDTH}"/>
          <ResourceWrapper x:Key="ControlHeight" Resource="{StaticResource REFLEXION_HEIGHT}"/>
          <ControlTemplate x:Key="MakeReflexion">
            <Image x:Name="ItemTypeImage" Grid.Row="0" Stretch="Uniform" Source="NavigationLarge.png"
              Width="{StaticResource MEDIA_POSTER_WIDTH}" Height="{StaticResource MEDIA_POSTER_HEIGHT}"/>
          </ControlTemplate>
        </Control.Resources>
      </Control>

      <Label x:Name="ItemLabel" Grid.Row="1" Content="{Binding SimpleTitle}" Color="{ThemeResource TextColor}"
           FontSize="{ThemeResource SmallFontSize}" HorizontalAlignment="Center"/>
    </Grid>
  </ControlTemplate>

  <!-- Series Filter -->
  <ControlTemplate x:Key="ListViewSeriesFilterItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="55"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>

      <Label x:Name="ItemLabel" Grid.Row="0" Grid.Column="1" Content="{Binding SimpleTitle}" 
             FontSize="{ThemeResource SmallFontSize}" Color="{ThemeResource TextColor}" VerticalAlignment="Center"/>
      <Image x:Name="ItemTypeSmall" Stretch="Uniform"
             FallbackSource="defaultVideo.png" Width="{StaticResource MEDIA_THUMB_WIDTH_S}" Height="{StaticResource MEDIA_THUMB_HEIGHT_S}">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="Series" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"/>
        </Image.Source>
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Small}"/>
        </Image.IsVisible>
      </Image>
      <Image x:Name="ItemTypeMedium" Stretch="Uniform"
             FallbackSource="defaultVideo.png" Width="{StaticResource MEDIA_THUMB_WIDTH_M}" Height="{StaticResource MEDIA_THUMB_HEIGHT_M}">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="Series" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"/>
        </Image.Source>
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Medium}"/>
        </Image.IsVisible>
      </Image>
      <Image x:Name="ItemTypeLarge" Stretch="Uniform"
             FallbackSource="defaultVideo.png" Width="{StaticResource MEDIA_THUMB_WIDTH_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="Series" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"/>
        </Image.Source>
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Large}"/>
        </Image.IsVisible>
      </Image>
      <Label x:Name="NumItems" Grid.Row="0" Grid.Column="2" Content="{Binding NumItems}" HorizontalAlignment="Right" VerticalAlignment="Center"
             Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}" Margin="0,0,5,0"/>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="GridViewSeriesFilterItemTemplate">
    <Grid x:Name="ItemControl" Margin="50,0,0,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource MEDIA_BANNER_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource MEDIA_BANNER_HEIGHT}"/>
      </Grid.RowDefinitions>    
      <Image x:Name="thumb" Width="{StaticResource MEDIA_BANNER_WIDTH}" Height="{StaticResource MEDIA_BANNER_HEIGHT}" 
             Stretch="Fill" Margin="-1" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="Series" fanart:FanArtType="Banner" fanart:FanArtName="{Binding SimpleTitle}"
                                    fanart:MaxWidth="{StaticResource FANART_BANNER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_BANNER_HEIGHT}"/>
        </Image.Source>
        <Image.OpacityMask >
          <ImageBrush ImageSource="tvseries_widebanner_mask.png"/>
        </Image.OpacityMask>
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Fill" Margin="-1" IsVisible="{Binding ElementName=thumb, Path=!HasImage}" 
             Source="tvseries_widebanner_background.png" Opacity="0.85"/>
      <Image Source="tvseries_widebanner_large_focus.png" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill" Margin="0,0,0,0"
       IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="CoverViewSeriesFilterItemTemplate">
    <Grid x:Name="ItemControl" Margin="-4,200,-3,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource COVERVIEW_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Width="{StaticResource COVERVIEW_WIDTH}" Height="{StaticResource COVERVIEW_HEIGHT}" Stretch="Fill"
             VerticalAlignment="Bottom">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="Series" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.OpacityMask >
          <ImageBrush ImageSource="filmstrip_mask.png"/>
        </Image.OpacityMask>
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Fill" Margin="0" IsVisible="{Binding ElementName=thumb, Path=!HasImage}" Source="filmstrip_background.png"/>
      <Image Stretch="Uniform" Margin="60" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultVideo.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <!-- Unwatched indicator -->
      <!--Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,1,0,0">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image-->
    </Grid>
  </ControlTemplate>
   
  <!-- Series Season -->
  <ControlTemplate x:Key="ListViewSeriesSeasonFilterItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="60"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>

      <Label x:Name="ItemLabel" Grid.Row="0" Grid.Column="1" Content="{Binding SimpleTitle}" FontSize="{ThemeResource SmallFontSize}" 
             VerticalAlignment="Center" Color="{ThemeResource TextColor}"/>
      <Image x:Name="ItemTypeSmall" Stretch="Uniform"
             FallbackSource="VideoSmall.png" Width="{StaticResource MEDIA_THUMB_WIDTH_S}" Height="{StaticResource MEDIA_THUMB_HEIGHT_S}">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="SeriesSeason" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Small}"/>
        </Image.IsVisible>
      </Image>
      <Image x:Name="ItemTypeMedium" Stretch="Uniform"
            FallbackSource="VideoSmall.png" Width="{StaticResource MEDIA_THUMB_WIDTH_M}" Height="{StaticResource MEDIA_THUMB_HEIGHT_M}">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="SeriesSeason" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Medium}"/>
        </Image.IsVisible>
      </Image>
      <Image x:Name="ItemTypeLarge" Stretch="Uniform"
            FallbackSource="VideoLarge.png" Width="{StaticResource MEDIA_THUMB_WIDTH_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="SeriesSeason" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Large}"/>
        </Image.IsVisible>
      </Image>

      <!-- TODO: Year -->
      <Label x:Name="NumItems" Grid.Row="0" Grid.Column="2" Content="{Binding NumItems}" HorizontalAlignment="Right" VerticalAlignment="Center"
             Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}" Margin="0,0,10,0"/>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="GridViewSeriesSeasonFilterItemTemplate">
    <Grid x:Name="ItemControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="50,0,0,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource MEDIA_BANNER_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource MEDIA_BANNER_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Stretch="Fill" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center"
             Width="{StaticResource MEDIA_BANNER_WIDTH}" Height="{StaticResource MEDIA_BANNER_HEIGHT}"
             Grid.Row="0" Grid.Column="0">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="SeriesSeason" fanart:FanArtType="Banner" fanart:FanArtName="{Binding SimpleTitle}"/>
        </Image.Source>
        <Image.OpacityMask >
          <ImageBrush ImageSource="tvseries_widebanner_mask.png"/>
        </Image.OpacityMask>
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Fill" Margin="-1" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
       Source="tvseries_widebanner_background.png" Opacity="0.85"/>
      <Image Source="tvseries_widebanner_large_focus.png" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill" Margin="0,0,0,0"
             IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
      <!-- Unwatched indicator -->
      <!--Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image-->
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="CoverViewSeriesSeasonFilterItemTemplate">
    <Grid x:Name="ItemControl" Margin="-4,200,-3,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource COVERVIEW_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Width="{StaticResource COVERVIEW_WIDTH}" Height="{StaticResource COVERVIEW_HEIGHT}" Stretch="Fill"
             VerticalAlignment="Bottom">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="SeriesSeason" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.OpacityMask >
          <ImageBrush ImageSource="filmstrip_mask.png"/>
        </Image.OpacityMask>
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Fill" Margin="0" IsVisible="{Binding ElementName=thumb, Path=!HasImage}" Source="filmstrip_background.png"/>
      <Image Stretch="Uniform" Margin="60" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultVideo.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <!-- Unwatched indicator -->
      <!--Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,1,0,0">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image-->
    </Grid>
  </ControlTemplate>
   
  <!-- Movie Collection Filter -->

  <ControlTemplate x:Key="ListViewMovieFilterItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="50"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>

      <Label x:Name="ItemLabel" Grid.Row="0" Grid.Column="1" Content="{Binding SimpleTitle}" FontSize="{ThemeResource SmallFontSize}"
             VerticalAlignment="Center" Color="{ThemeResource TextColor}">
      </Label>
      <Image x:Name="ItemTypeSmall" Stretch="Uniform"
            FallbackSource="defaultVideo.png" Width="{StaticResource MEDIA_THUMB_WIDTH_S}" Height="{StaticResource MEDIA_THUMB_HEIGHT_S}">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="MovieCollection" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Small}"/>
        </Image.IsVisible>
      </Image>
      <Image x:Name="ItemTypeMedium" Stretch="Uniform"
            FallbackSource="defaultVideo.png" Width="{StaticResource MEDIA_THUMB_WIDTH_M}" Height="{StaticResource MEDIA_THUMB_HEIGHT_M}">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="MovieCollection" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Medium}"/>
        </Image.IsVisible>
      </Image>
      <Image x:Name="ItemTypeLarge" Stretch="Uniform"
            FallbackSource="defaultVideo.png" Width="{StaticResource MEDIA_THUMB_WIDTH_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="MovieCollection" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Large}"/>
        </Image.IsVisible>
      </Image>

      <Label x:Name="NumItems" Grid.Row="0" Grid.Column="2" Content="{Binding NumItems}" HorizontalAlignment="Right" VerticalAlignment="Center"
             Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}"/>
    </Grid>
  </ControlTemplate>
  
  <ControlTemplate x:Key="GridViewMovieFilterItemTemplate">
    <Grid x:Name="ItemControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource MEDIA_POSTER_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource MEDIA_POSTER_HEIGHT}"/>
      </Grid.RowDefinitions>
       <Image x:Name="thumb" Stretch="Fill" Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center"
             Grid.Row="0" Grid.Column="0">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="MovieCollection" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.OpacityMask >
          <ImageBrush ImageSource="video_thumb_mask.png"/>
        </Image.OpacityMask>
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>   
      <Image Stretch="Fill" Margin="3" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="filmstrip_background.png" Opacity="0.85"/>
      <Image Stretch="Uniform" Margin="20" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultVideo.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>             
      <Image Source="video_thumb_focus.png" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill" Margin="0,0,0,0"
             IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="CoverViewMovieFilterItemTemplate">
    <Grid x:Name="ItemControl" Margin="-4,200,-3,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource COVERVIEW_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Grid.Column="1" Width="{StaticResource COVERVIEW_WIDTH}" Height="{StaticResource COVERVIEW_HEIGHT}" Stretch="Fill"
             FallbackSource="defaultVideo.png" VerticalAlignment="Bottom">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="MovieCollection" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                              fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.OpacityMask >
          <ImageBrush ImageSource="filmstrip_mask.png"/>
        </Image.OpacityMask>
      </Image>
      <!-- Unwatched indicator -->
      <Image Grid.Column="1" Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,1,0,0">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </ControlTemplate>


  <!-- Movie -->
  <ControlTemplate x:Key="ListViewMovieItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="50"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>

      <Label x:Name="ItemLabel" Grid.Row="0" Grid.Column="1" Content="{Binding SimpleTitle}" FontSize="{ThemeResource SmallFontSize}" VerticalAlignment="Center">
        <Label.Color>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == 0 ? {1} : {2}">
            <Binding Path="PlayCount"/>
            <Binding Source="{ThemeResource TextColor}"/>
            <Binding Source="{ThemeResource WatchedTextColor}"/>
          </MultiBinding>
        </Label.Color>
      </Label>
      <Image x:Name="ItemTypeSmall" Stretch="Uniform"
            Source="{Binding MediaItem}" FallbackSource="VideoSmall.png" Width="{StaticResource MEDIA_THUMB_WIDTH_S}" Height="{StaticResource MEDIA_THUMB_HEIGHT_S}">
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Small}"/>
        </Image.IsVisible>
      </Image>
      <Image x:Name="ItemTypeMedium" Stretch="Uniform"
            Source="{Binding MediaItem}" FallbackSource="VideoSmall.png" Width="{StaticResource MEDIA_THUMB_WIDTH_M}" Height="{StaticResource MEDIA_THUMB_HEIGHT_M}">
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Medium}"/>
        </Image.IsVisible>
      </Image>
      <Image x:Name="ItemTypeLarge" Stretch="Uniform"
            Source="{Binding MediaItem}" FallbackSource="VideoLarge.png" Width="{StaticResource MEDIA_THUMB_WIDTH_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}">
        <Image.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Large}"/>
        </Image.IsVisible>
      </Image>
      
      <!-- TODO: Year -->
      <Label x:Name="Year" Grid.Row="0" Grid.Column="2" Content="{Binding Year}"
          Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}"/>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="GridViewMovieItemTemplate">
    <Grid x:Name="ItemControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource MEDIA_POSTER_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource MEDIA_POSTER_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Stretch="Fill" Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center"
             Source="{Binding MediaItem}"
             Grid.Row="0" Grid.Column="0">
        <Image.OpacityMask >
          <ImageBrush ImageSource="video_thumb_mask.png"/>
        </Image.OpacityMask>
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Fill" Margin="3" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
       Source="filmstrip_background.png" Opacity="0.85"/>
      <Image Stretch="Uniform" Margin="20" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultVideo.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Source="video_thumb_focus.png" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill" Margin="0,0,0,0"
             IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
      <!-- Unwatched indicator -->
      <Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="CoverViewMovieItemTemplate">
    <Grid x:Name="ItemControl" Margin="-4,200,-3,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource COVERVIEW_HEIGHT}"/>
        </Grid.RowDefinitions>
          <Image x:Name="thumb" Grid.Column="1" Width="{StaticResource COVERVIEW_WIDTH}" Height="{StaticResource COVERVIEW_HEIGHT}" Stretch="Fill"
                 Source="{Binding MediaItem}" FallbackSource="defaultVideo.png" VerticalAlignment="Bottom">
            <Image.OpacityMask >
              <ImageBrush ImageSource="filmstrip_mask.png"/>
            </Image.OpacityMask>
          </Image>
        <!-- Unwatched indicator -->
        <Image Grid.Column="1" Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,1,0,0">
          <Image.IsVisible>
            <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
          </Image.IsVisible>
        </Image>
    </Grid>
  </ControlTemplate>

  <!-- Video -->
  <ControlTemplate x:Key="ListViewVideoItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>
      <DockPanel LastChildFill="True" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Margin="0,0,4,0">
        <Image x:Name="ItemTypeSmall" Stretch="Uniform"
            Source="{Binding MediaItem}" FallbackSource="defaultVideo.png" Width="{StaticResource MEDIA_THUMB_WIDTH_S}" Height="{StaticResource MEDIA_THUMB_HEIGHT_S}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Small}"/>
          </Image.IsVisible>
        </Image>
        <Image x:Name="ItemTypeMedium" Stretch="Uniform"
            Source="{Binding MediaItem}" FallbackSource="defaultVideo.png" Width="{StaticResource MEDIA_THUMB_WIDTH_M}" Height="{StaticResource MEDIA_THUMB_HEIGHT_M}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Medium}"/>
          </Image.IsVisible>
        </Image>
        <Image x:Name="ItemTypeLarge" Stretch="Uniform"
            Source="{Binding MediaItem}" FallbackSource="defaultVideo.png" Width="{StaticResource MEDIA_THUMB_WIDTH_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Large}"/>
          </Image.IsVisible>
        </Image>
      </DockPanel>
      <Label x:Name="ItemLabel" Grid.Row="0" Grid.Column="1" Content="{Binding SimpleTitle}" FontSize="{ThemeResource SmallFontSize}">
        <Label.Color>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == 0 ? {1} : {2}">
            <Binding Path="PlayCount"/>
            <Binding Source="{ThemeResource TextColor}"/>
            <Binding Source="{ThemeResource WatchedTextColor}"/>
          </MultiBinding>
        </Label.Color>
      </Label>
      <Label x:Name="Duration" Grid.Row="0" Grid.Column="2" Content="{Binding Duration}" Margin="0,0,15,0"
          Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}"/>
      <Grid x:Name="Details" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch">
        <Grid.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} != {LayoutSize}.{Small}"/>
        </Grid.IsVisible>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="200"/>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="200"/>
        </Grid.ColumnDefinitions>
        <Label x:Name="VideoEncodingTitle" Grid.Column="0" Content="Video: " FontSize="{ThemeResource SmallFontSize}" Color="{StaticResource MediaDetailsColor}"/>
        <Label x:Name="VideoEncoding" Grid.Column="1" Content="{Binding VideoEncoding}" FontSize="{ThemeResource SmallFontSize}" Color="{StaticResource MediaDetailsColor}"/>
        <Label x:Name="AudioEncodingTitle" Grid.Column="2" Content="Audio: " FontSize="{ThemeResource SmallFontSize}" Color="{StaticResource MediaDetailsColor}"/>
        <Label x:Name="AudioEncoding" Grid.Column="3" Content="{Binding AudioEncoding}" FontSize="{ThemeResource SmallFontSize}" Color="{StaticResource MediaDetailsColor}"/>
      </Grid>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="GridViewVideoItemTemplate">
    <Grid x:Name="ItemControl" Margin="8,3,0,3">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource MEDIA_VIDEO_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource MEDIA_VIDEO_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Stretch="Uniform" Margin="2,0,2,0"
             Source="{Binding MediaItem}" Width="{StaticResource MEDIA_VIDEO_WIDTH}">
        <Image.OpacityMask >
          <ImageBrush ImageSource="video_thumb_mask.png"/>
        </Image.OpacityMask>
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Fill" Margin="0" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="tvseries_thumb_background.png" Opacity="0.85">
      </Image>
      <Image Stretch="Uniform" Margin="25" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultVideo.png" >
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image> 
      <Image Source="episode_thumb_focus.png" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill"
             Width="{StaticResource MEDIA_VIDEO_WIDTH}" Margin="-8,-2,-6,-2"
             IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
      <!-- Unwatched indicator -->
      <Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="2">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="CoverViewVideoItemTemplate">
    <Grid x:Name="ItemControl" Margin="-4,200,-3,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource COVERVIEW_HEIGHT}"/>
      </Grid.RowDefinitions>

      <Grid.OpacityMask>
        <ImageBrush ImageSource="filmstrip_mask.png"/>
      </Grid.OpacityMask>
      
      <Image Stretch="Fill" Margin="0" Source="filmstrip_background.png" VerticalAlignment="Bottom" Opacity="0.95"/>
      <Image x:Name="thumb" Stretch="Uniform" Margin="0"
             VerticalAlignment="Bottom" Source="{Binding MediaItem}">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Uniform" Margin="60" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultVideo.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <!--Unwatched indicator -->
      <Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,1,0,0">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </ControlTemplate>
  
  <!-- Audio -->
  <ControlTemplate x:Key="ListViewAudioItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>
      <DockPanel LastChildFill="True" Grid.Row="0" Grid.Column="0" Margin="0,0,5,0">
        <Image x:Name="ItemTypeSmall" Stretch="Uniform" Width="{StaticResource MEDIA_THUMB_HEIGHT_S}" Height="{StaticResource MEDIA_THUMB_HEIGHT_S}"
               Source="{Binding MediaItem}" FallbackSource="defaultAudio.png">
          <Image.OpacityMask >
            <ImageBrush ImageSource="music_filmstrip_mask.png"/>
          </Image.OpacityMask>
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Small}"/>
          </Image.IsVisible>
        </Image>

        <Image x:Name="ItemTypeMedium" Stretch="Uniform"  Width="{StaticResource MEDIA_THUMB_HEIGHT_M}" Height="{StaticResource MEDIA_THUMB_HEIGHT_M}"
               Source="{Binding MediaItem}" FallbackSource="defaultAudio.png">
          <Image.OpacityMask >
            <ImageBrush ImageSource="music_filmstrip_mask.png"/>
          </Image.OpacityMask>
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Medium}"/>
          </Image.IsVisible>
        </Image>
        <Image x:Name="ItemTypeLarge" Stretch="Uniform"  Width="{StaticResource MEDIA_THUMB_HEIGHT_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}"
               Source="{Binding MediaItem}" FallbackSource="defaultAudio.png">
          <Image.OpacityMask >
            <ImageBrush ImageSource="music_filmstrip_mask.png"/>
          </Image.OpacityMask>
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Large}"/>
          </Image.IsVisible>
        </Image>
      </DockPanel>
      <Label x:Name="ItemLabel" Grid.Column="1" Content="{Binding SimpleTitle}" Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}" Margin="8,0,4,0">
        <Label.Color>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == 0 ? {1} : {2}">
            <Binding Path="PlayCount"/>
            <Binding Source="{ThemeResource TextColor}"/>
            <Binding Source="{ThemeResource WatchedTextColor}"/>
          </MultiBinding>
        </Label.Color>
      </Label>
      <Label x:Name="Duration" Grid.Column="2" Content="{Binding Duration}" Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}" Margin="4,0,4,0"/>
    </Grid>
  </ControlTemplate>
  
  <ControlTemplate x:Key="GridViewAudioItemTemplate">
    <Grid x:Name="ItemControl" Margin="30,4,-20,4">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource MEDIA_AUDIO_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource MEDIA_AUDIO_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Stretch="Fill" Margin="1"
             Source="{Binding MediaItem}" Width="{StaticResource MEDIA_AUDIO_WIDTH}">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
        <Image.OpacityMask >
          <ImageBrush ImageSource="music_filmstrip_mask.png"/>
        </Image.OpacityMask>
      </Image>
      <Image Stretch="Fill" Margin="1" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="music_background_mask.png" Opacity="0.85">
      </Image>
      <Image Stretch="Uniform" Margin="25" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultAudio.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Source="music_thumb_focus.png" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill"
             Margin="-5"
             IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
      <!-- Unwatched indicator -->
      <Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-2">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="CoverViewAudioItemTemplate">
    <Grid x:Name="ItemControl" Margin="-4,320,-3,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Width="{StaticResource COVERVIEW_WIDTH}" Height="{StaticResource COVERVIEW_WIDTH}" Stretch="Fill"
             Source="{Binding MediaItem}" VerticalAlignment="Bottom">
        <Image.OpacityMask >
          <ImageBrush ImageSource="music_filmstrip_mask.png"/>
        </Image.OpacityMask>
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Fill" Margin="0" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
       Source="music_background_mask.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Uniform" Margin="80" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultAudio.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <!-- Unwatched indicator -->
      <Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,1,0,0">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </ControlTemplate>
  
  <!-- Audio Album -->
  <ControlTemplate x:Key="ListViewAlbumItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>
      <DockPanel LastChildFill="True" Grid.Row="0" Grid.Column="0" Margin="0,0,5,0">
        <Image x:Name="ItemTypeSmall" Stretch="Uniform" Width="{StaticResource MEDIA_THUMB_HEIGHT_S}" Height="{StaticResource MEDIA_THUMB_HEIGHT_S}"
               FallbackSource="defaultAudio.png">
          <Image.Source>
            <fanart:FanArtImageSource fanart:FanArtMediaType="Album" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
          </Image.Source>
          <Image.OpacityMask >
            <ImageBrush ImageSource="music_filmstrip_mask.png"/>
          </Image.OpacityMask>
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Small}"/>
          </Image.IsVisible>
        </Image>
        
        <Image x:Name="ItemTypeMedium" Stretch="Uniform"  Width="{StaticResource MEDIA_THUMB_HEIGHT_M}" Height="{StaticResource MEDIA_THUMB_HEIGHT_M}"
               FallbackSource="defaultAudio.png">
          <Image.Source>
            <fanart:FanArtImageSource fanart:FanArtMediaType="Album" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
          </Image.Source>
          <Image.OpacityMask >
            <ImageBrush ImageSource="music_filmstrip_mask.png"/>
          </Image.OpacityMask>
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Medium}"/>
          </Image.IsVisible>
        </Image>
        <Image x:Name="ItemTypeLarge" Stretch="Uniform"  Width="{StaticResource MEDIA_THUMB_HEIGHT_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}"
               FallbackSource="defaultAudio.png">
          <Image.Source>
            <fanart:FanArtImageSource fanart:FanArtMediaType="Album" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                    fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
          </Image.Source>
          <Image.OpacityMask >
            <ImageBrush ImageSource="music_filmstrip_mask.png"/>
          </Image.OpacityMask>
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Large}"/>
          </Image.IsVisible>
        </Image>
      </DockPanel>
      <Label x:Name="ItemLabel" Grid.Column="1" Content="{Binding SimpleTitle}" Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}" Margin="8,0,4,0" />
      <Label x:Name="NumItems" Grid.Row="0" Grid.Column="2" Content="{Binding NumItems}" HorizontalAlignment="Right" VerticalAlignment="Center"
       Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}" Margin="0,0,5,0"/>
      <!--Label x:Name="Duration" Grid.Column="2" Content="{Binding Duration}" Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}" Margin="4,0,4,0"/-->
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="GridViewAlbumItemTemplate">
    <Grid x:Name="ItemControl" Margin="30,4,-20,4">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource MEDIA_AUDIO_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource MEDIA_AUDIO_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Stretch="Fill" Margin="1"
             Width="{StaticResource MEDIA_AUDIO_WIDTH}">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="Album" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
                    fanart:MaxWidth="{StaticResource MEDIA_AUDIO_WIDTH}" fanart:MaxHeight="{StaticResource MEDIA_AUDIO_HEIGHT}"/>
        </Image.Source>
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
        <Image.OpacityMask >
          <ImageBrush ImageSource="music_filmstrip_mask.png"/>
        </Image.OpacityMask>
      </Image>
      <Image Stretch="Fill" Margin="1" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="music_background_mask.png" Opacity="0.85">
      </Image>
      <Image Stretch="Uniform" Margin="25" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultAudio.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Source="music_thumb_focus.png" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill"
             Margin="-5"
             IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
      <!-- Unwatched indicator -->
      <Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-2">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="CoverViewAlbumItemTemplate">
    <Grid x:Name="ItemControl" Margin="-4,321,-3,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Width="{StaticResource COVERVIEW_WIDTH}" Height="{StaticResource COVERVIEW_WIDTH}" Stretch="Fill"
             VerticalAlignment="Bottom">
        <Image.Source>
          <fanart:FanArtImageSource fanart:FanArtMediaType="Album" fanart:FanArtType="Poster" fanart:FanArtName="{Binding SimpleTitle}"
              fanart:MaxWidth="{StaticResource FANART_POSTER_WIDTH}" fanart:MaxHeight="{StaticResource FANART_POSTER_HEIGHT}"/>
        </Image.Source>
        <Image.OpacityMask >
          <ImageBrush ImageSource="music_filmstrip_mask.png"/>
        </Image.OpacityMask>
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Fill" Margin="0" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
       Source="music_background_mask.png" Opacity="0.85">
      </Image>
      <Image Stretch="Uniform" Margin="80" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultAudio.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <!-- Unwatched indicator -->
      <Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,1,0,0">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </ControlTemplate>

 <!-- Image -->
  <ControlTemplate x:Key="ListViewImageItemTemplate">
    <Grid x:Name="ItemControl">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>
      <DockPanel LastChildFill="True" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Margin="0,0,4,0">
        <Image x:Name="ItemTypeSmall" Stretch="Uniform"
             Source="{Binding MediaItem}" FallbackSource="ImageSmall.png" Width="{StaticResource MEDIA_THUMB_WIDTH_S}" Height="{StaticResource MEDIA_THUMB_HEIGHT_S}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Small}"/>
          </Image.IsVisible>
        </Image>
        <Image x:Name="ItemTypeMedium" Stretch="Uniform"
            Source="{Binding MediaItem}" FallbackSource="ImageSmall.png" Width="{StaticResource MEDIA_THUMB_WIDTH_M}" Height="{StaticResource MEDIA_THUMB_HEIGHT_M}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Medium}"/>
          </Image.IsVisible>
        </Image>
        <Image x:Name="ItemTypeLarge" Stretch="Uniform"
            Source="{Binding MediaItem}" FallbackSource="ImageLarge.png" Width="{StaticResource MEDIA_THUMB_WIDTH_L}" Height="{StaticResource MEDIA_THUMB_HEIGHT_L}">
          <Image.IsVisible>
            <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == {LayoutSize}.{Large}"/>
          </Image.IsVisible>
        </Image>
      </DockPanel>
      <Label x:Name="ItemLabel" Grid.Row="0" Grid.Column="1" Content="{Binding SimpleTitle}" FontSize="{ThemeResource SmallFontSize}">
        <Label.Color>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == 0 ? {1} : {2}">
            <Binding Path="PlayCount"/>
            <Binding Source="{ThemeResource TextColor}"/>
            <Binding Source="{ThemeResource WatchedTextColor}"/>
          </MultiBinding>
        </Label.Color>
      </Label>
      <Label x:Name="Size" Grid.Row="0" Grid.Column="2" Content="{Binding Size}"
          Color="{ThemeResource TextColor}" FontSize="{ThemeResource SmallFontSize}"/>
      <Grid x:Name="Details" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch">
        <Grid.IsVisible>
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutSize" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} != {LayoutSize}.{Small}"/>
        </Grid.IsVisible>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="200"/>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="200"/>
        </Grid.ColumnDefinitions>
        <Label x:Name="FileTypeTitle" Grid.Column="0" Content="File type: " FontSize="{ThemeResource SmallFontSize}" Color="{StaticResource MediaDetailsColor}"/>
        <Label x:Name="FileType" Grid.Column="1" Content="{Binding Extension}" FontSize="{ThemeResource SmallFontSize}" Color="{StaticResource MediaDetailsColor}"/>
        <Label x:Name="MimeTypeTitle" Grid.Column="2" Content="Mime type: " FontSize="{ThemeResource SmallFontSize}" Color="{StaticResource MediaDetailsColor}"/>
        <Label x:Name="MimeType" Grid.Column="3" Content="{Binding MimeType}" FontSize="{ThemeResource SmallFontSize}" Color="{StaticResource MediaDetailsColor}"/>
      </Grid>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="GridViewImageItemTemplate">
    <Grid x:Name="ItemControl" Margin="30,4,-20,4">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource MEDIA_AUDIO_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource MEDIA_AUDIO_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Stretch="Uniform" Margin="1" Source="{Binding MediaItem}">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
        <Image.OpacityMask >
          <ImageBrush ImageSource="music_filmstrip_mask.png"/>
        </Image.OpacityMask>
      </Image>
      <Image Stretch="Fill" Margin="1" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="music_background_mask.png" Opacity="0.85">
      </Image>
      <Image Stretch="Uniform" Margin="25" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultPicture.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Source="music_thumb_focus.png" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill"
             Margin="-5"
             IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
      <!-- Unwatched indicator -->
      <Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-2">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="CoverViewImageItemTemplate">
    <Grid x:Name="ItemControl" Margin="-4,321,-3,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource COVERVIEW_WIDTH}"/>
      </Grid.RowDefinitions>
      <Image Stretch="Fill" Margin="0"
             Source="music_background_mask.png" Opacity="0.85">
      </Image>
      <Image x:Name="thumb" Width="{StaticResource COVERVIEW_WIDTH}" Height="{StaticResource COVERVIEW_WIDTH}" Stretch="Uniform"
             VerticalAlignment="Bottom" Source="{Binding MediaItem}">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <!--Image Stretch="Fill" Margin="0" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
       Source="music_background_mask.png" Opacity="0.85">
      </Image-->
      <Image Stretch="Uniform" Margin="80" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="defaultPicture.png">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <!-- Unwatched indicator -->
      <Image Source="unwatched_flag.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,1,0,0">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </ControlTemplate>

  <!-- Specific media navigation data templates -->
  <DataTemplate DataType="{x:Type navitems:SeriesFilterItem}">
    <Control>
      <Control.Template>
        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
          <Binding Source="{StaticResource ListViewSeriesFilterItemTemplate}"/>
          <Binding Source="{StaticResource GridViewSeriesFilterItemTemplate}"/>
          <Binding Source="{StaticResource CoverViewSeriesFilterItemTemplate}"/>
        </MultiBinding>
      </Control.Template>
    </Control>
  </DataTemplate>

  <DataTemplate DataType="{x:Type navitems:SeasonFilterItem}">
    <Control>
      <Control.Template>
        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
          <Binding Source="{StaticResource ListViewSeriesSeasonFilterItemTemplate}"/>
          <Binding Source="{StaticResource GridViewSeriesSeasonFilterItemTemplate}"/>
          <Binding Source="{StaticResource CoverViewSeriesSeasonFilterItemTemplate}"/>
        </MultiBinding>
      </Control.Template>
    </Control>
  </DataTemplate>

  <DataTemplate DataType="{x:Type navitems:MovieFilterItem}">
    <Control>
      <Control.Template>
        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
          <Binding Source="{StaticResource ListViewMovieFilterItemTemplate}"/>
          <Binding Source="{StaticResource GridViewMovieFilterItemTemplate}"/>
          <Binding Source="{StaticResource CoverViewMovieFilterItemTemplate}"/>
        </MultiBinding>
      </Control.Template>
    </Control>
  </DataTemplate>

  <DataTemplate DataType="{x:Type navitems:MovieItem}">
    <Control>
      <Control.Template>
        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
          <Binding Source="{StaticResource ListViewMovieItemTemplate}"/>
          <Binding Source="{StaticResource GridViewMovieItemTemplate}"/>
          <Binding Source="{StaticResource CoverViewMovieItemTemplate}"/>
        </MultiBinding>
      </Control.Template>
    </Control>
  </DataTemplate>


  <DataTemplate DataType="{x:Type navitems:ContainerItem}">
    <Control>
      <Control.Template>
        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
          <Binding Source="{StaticResource ListViewContainerItemTemplate}"/>
          <Binding Source="{StaticResource GridViewContainerItemTemplate}"/>
          <Binding Source="{StaticResource CoverViewContainerItemTemplate}"/>
        </MultiBinding>
      </Control.Template>
    </Control>
  </DataTemplate>

  <DataTemplate DataType="{x:Type navitems:FilterItem}">
    <Control>
      <Control.Template>
        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
          <Binding Source="{StaticResource ListViewFilterItemTemplate}"/>
          <Binding Source="{StaticResource GridViewFilterItemTemplate}"/>
          <Binding Source="{StaticResource CoverViewFilterItemTemplate}"/>
        </MultiBinding>
      </Control.Template>
    </Control>
  </DataTemplate>

  <DataTemplate DataType="{x:Type navitems:VideoItem}">
    <Control>
      <Control.Template>
        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
          <Binding Source="{StaticResource ListViewVideoItemTemplate}"/>
          <Binding Source="{StaticResource GridViewVideoItemTemplate}"/>
          <Binding Source="{StaticResource CoverViewVideoItemTemplate}"/>
        </MultiBinding>
      </Control.Template>
    </Control>
  </DataTemplate>

  <DataTemplate DataType="{x:Type navitems:AudioItem}">
    <Control>
      <Control.Template>
        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
          <Binding Source="{StaticResource ListViewAudioItemTemplate}"/>
          <Binding Source="{StaticResource GridViewAudioItemTemplate}"/>
          <Binding Source="{StaticResource CoverViewAudioItemTemplate}"/>
        </MultiBinding>
      </Control.Template>
    </Control>
  </DataTemplate>

  <DataTemplate DataType="{x:Type navitems:AlbumFilterItem}">
    <Control>
      <Control.Template>
        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
          <Binding Source="{StaticResource ListViewAlbumItemTemplate}"/>
          <Binding Source="{StaticResource GridViewAlbumItemTemplate}"/>
          <Binding Source="{StaticResource CoverViewAlbumItemTemplate}"/>
        </MultiBinding>
      </Control.Template>
    </Control>
  </DataTemplate>

  <DataTemplate DataType="{x:Type navitems:ImageItem}">
    <Control>
      <Control.Template>
        <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
          <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
          <Binding Source="{StaticResource ListViewImageItemTemplate}"/>
          <Binding Source="{StaticResource GridViewImageItemTemplate}"/>
          <Binding Source="{StaticResource CoverViewImageItemTemplate}"/>
        </MultiBinding>
      </Control.Template>
    </Control>
  </DataTemplate>

  <DataStringProvider x:Key="MediaItemDataStringProvider" Path="SimpleTitle"/>

  <!-- An item list container represented by a standard "Button", scrolling its "ItemLabel" label when focused -->
  <Style x:Key="MediaItemContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListViewItem}">
          <Button Style="{ThemeResource ButtonWideStyle}" Margin="5,0,0,5"
              Command="{DynamicResource ResourceKey=Menu_Command}"
              IsEnabled="{Binding Enabled}" SetFocus="{Binding Path=Selected,Mode=OneTime}">
            <Button.Triggers>
              <Trigger Property="HasFocus" Value="True">
                <Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/>
              </Trigger>
            </Button.Triggers>
          </Button>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Model x:Key="MediaItemsActionModel" Id="970649B2-CAE8-4830-A985-E5E78F3CB24F"/>

  <!-- An item list container used for MediaItems. Additionally to the standard "Button", it adds a context menu command  -->
  <Style x:Key="MediaItemWithContextMenuContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListViewItem}">
          <Button Style="{ThemeResource ButtonMediaItemStyle}"
              Command="{DynamicResource ResourceKey=Menu_Command}"
              IsEnabled="{Binding Enabled}" SetFocus="{Binding Path=Selected,Mode=OneTime}">
            <Button.Triggers>
              <Trigger Property="HasFocus" Value="True">
                <Setter TargetName="ButtonControlRectangle" Property="IsVisible" Value="True"/>
                <Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/>
                <Setter Property="StackPanel.ZIndex" Value="100.0"/>
              </Trigger>
            </Button.Triggers>
            <Button.ContextMenuCommand>
              <Command Source="{StaticResource MediaItemsActionModel}" Path="ShowMediaItemActions" Parameters="{LateBoundValue BindingValue={Binding MediaItem}}"/>
            </Button.ContextMenuCommand>
          </Button>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="CoverMediaItemContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListViewItem}">
          <Button Style="{ThemeResource ButtonWideStyle_GrowOnly}"
              Command="{DynamicResource ResourceKey=Menu_Command}"
              IsEnabled="{Binding Enabled}" SetFocus="{Binding Path=Selected,Mode=OneTime}">
            <Button.Triggers>
              <Trigger Property="HasFocus" Value="True">
                <Setter TargetName="ItemLabel" Property="IsVisible" Value="True"/>
                <Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/>
              </Trigger>
            </Button.Triggers>
            <Button.ContextMenuCommand>
              <Command Source="{StaticResource MediaItemsActionModel}" Path="ShowMediaItemActions" Parameters="{LateBoundValue BindingValue={Binding MediaItem}}"/>
            </Button.ContextMenuCommand>
          </Button>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MediaItemCoverMenuContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListViewItem}">
          <Button Style="{ThemeResource ButtonMediaItemCoverStyle}"
              Command="{DynamicResource ResourceKey=Menu_Command}"
              IsEnabled="{Binding Enabled}" SetFocus="{Binding Path=Selected,Mode=OneTime}">
            <Button.Triggers>
              <Trigger Property="HasFocus" Value="True">
                <Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/>
                <Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/>
              </Trigger>
            </Button.Triggers>
            <Button.ContextMenuCommand>
              <Command Source="{StaticResource MediaItemsActionModel}" Path="ShowMediaItemActions" Parameters="{LateBoundValue BindingValue={Binding MediaItem}}"/>
            </Button.ContextMenuCommand>
          </Button>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  
  <Style x:Key="MediaItemsListListViewStyle" BasedOn="{ThemeResource ContentsMenuListViewStyle}">
    <EventSetter Event="SelectionChanged" Handler="{CommandStencil Source={StaticResource FanArtBackgroundModel}, Path=SetSelectedItem}"/>
    <Setter Property="ItemTemplate"/>
    <!-- Don't inherit the ItemTemplate from ContentsMenuListViewStyle - It should remain null to make the SkinEngine choose an appropriate template -->
    <Setter Property="DataStringProvider" Value="{ThemeResource MediaItemDataStringProvider}"/>
    <BindingSetter Property="ItemContainerStyle">
      <BindingSetter.BindingWrapper>
        <BindingWrapper>
          <BindingWrapper.Binding>
            <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
              <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
              <Binding Source="{ThemeResource MediaItemWithContextMenuContainerStyle}"/>
              <Binding Source="{ThemeResource MediaItemCoverMenuContainerStyle}"/>
              <Binding Source="{ThemeResource CoverMediaItemContainerStyle}"/>
            </MultiBinding>
          </BindingWrapper.Binding>
        </BindingWrapper>
      </BindingSetter.BindingWrapper>
    </BindingSetter>
    <!--Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListView}">
          <ScrollViewer CanContentScroll="True" Margin="5"
              HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
            <ItemsPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
          </ScrollViewer>
        </ControlTemplate>
      </Setter.Value>
    </Setter-->
    <BindingSetter Property="Template">
      <BindingSetter.BindingWrapper>
        <BindingWrapper>
          <BindingWrapper.Binding>
            <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
              <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
              <!-- List layout -->
              <Binding>
                <Binding.Source>
                  <ControlTemplate TargetType="{x:Type ListView}">
                    <ScrollViewer CanContentScroll="True" Margin="5" 
                                  VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                      <ItemsPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                    </ScrollViewer>
                  </ControlTemplate>
                </Binding.Source>
              </Binding>
              <!-- Grid layout -->
              <Binding>
                <Binding.Source>
                  <ControlTemplate TargetType="{x:Type ListView}">
                    <ScrollViewer CanContentScroll="True" Margin="5" Style="{ThemeResource GradientScrollViewerStyle}"
                        HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                      <ItemsPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                    </ScrollViewer>
                  </ControlTemplate>
                </Binding.Source>
              </Binding>
              <!-- Cover layout -->
              <Binding>
                <Binding.Source>
                  <ControlTemplate TargetType="{x:Type ListView}">
                    <ScrollViewer CanContentScroll="True" Margin="-20,0,20,0" Style="{ThemeResource AutoCenterScrollViewerStyle}"
                        HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                      <ItemsPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                    </ScrollViewer>
                  </ControlTemplate>
                </Binding.Source>
              </Binding>
            </MultiBinding>
          </BindingWrapper.Binding>
        </BindingWrapper>
      </BindingSetter.BindingWrapper>
    </BindingSetter>

    <BindingSetter Property="ItemsPanel">
      <BindingSetter.BindingWrapper>
        <BindingWrapper>
          <BindingWrapper.Binding>
            <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} == {LayoutType}.{ListLayout} ? {1} : ({0} == {LayoutType}.{GridLayout} ? {2} : {3})">
              <Binding Source="{StaticResource ViewModeModel}" Path="LayoutType"/>
              <!-- List layout -->
              <Binding>
                <Binding.Source>
                  <ItemsPanelTemplate>
                    <VirtualizingStackPanel x:Name="ListItemsHost" IsItemsHost="True" LoopScroll="True" />
                  </ItemsPanelTemplate>
                </Binding.Source>
              </Binding>
              <!-- Grid layout -->
              <Binding>
                <Binding.Source>
                  <ItemsPanelTemplate>
                    <VirtualizingWrapPanel x:Name="GridItemsHost" IsItemsHost="True" LoopScroll="True"/>
                  </ItemsPanelTemplate>
                </Binding.Source>
              </Binding>
              <!-- Cover layout -->
              <Binding>
                <Binding.Source>
                  <ItemsPanelTemplate>
                    <VirtualizingStackPanel x:Name="CoverListItemsHost" IsItemsHost="True" Orientation="Horizontal" LoopScroll="True"> </VirtualizingStackPanel>
                  </ItemsPanelTemplate>
                </Binding.Source>
              </Binding>
            </MultiBinding>
          </BindingWrapper.Binding>
        </BindingWrapper>
      </BindingSetter.BindingWrapper>
    </BindingSetter>
  </Style>

   <DataTemplate x:Key="HomeScreenItemTemplate" DataType="{x:Type collections:ListItem}">
    <Grid x:Name="ItemControl" Margin="5">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="{StaticResource MEDIA_AUDIO_WIDTH}"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="{StaticResource MEDIA_AUDIO_HEIGHT}"/>
      </Grid.RowDefinitions>
      <Image x:Name="thumb" Stretch="Uniform" Margin="0" Source="{Binding MediaItem}"
             Width="{StaticResource MEDIA_AUDIO_WIDTH}">
        <Image.Opacity>
          <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {1} : {2}">
            <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}}" Path="HasFocus"/>
            <Binding Source="1.0"/>
            <Binding Source="0.85"/>
          </MultiBinding>
        </Image.Opacity>
      </Image>
      <Image Stretch="Fill" Margin="1" IsVisible="{Binding ElementName=thumb, Path=!HasImage}"
             Source="music_background_mask.png" Opacity="0.85">
      </Image>
      <Image Source="music_thumb_focus.png" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill"
             Margin="-5"
             IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Button}},Path=HasFocus}">
      </Image>
      <!-- Unwatched indicator -->
      <Image Source="unwatched_flag.png" Stretch="Uniform" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-2" Height="40" Width="40">
        <Image.IsVisible>
          <Binding Path="PlayCount" Converter="{StaticResource ExpressionValueConverter}" ConverterParameter="{}{0} == 0"/>
        </Image.IsVisible>
      </Image>
    </Grid>
  </DataTemplate>
  
  <Style x:Key="MediaItemsListListViewStyle2" BasedOn="{ThemeResource DefaultListViewStyle}">
    <EventSetter Event="SelectionChanged" Handler="{CommandStencil Source={StaticResource FanArtBackgroundModel}, Path=SetSelectedItem}"/>
    <Setter Property="ItemTemplate" Value="{ThemeResource HomeScreenItemTemplate}"/> 
    <!-- Don't inherit the ItemTemplate from ContentsMenuListViewStyle - It should remain null to make the SkinEngine choose an appropriate template -->
    <Setter Property="DataStringProvider" Value="{ThemeResource MediaItemDataStringProvider}"/>
    <Setter Property="ItemContainerStyle" Value="{ThemeResource MediaItemCoverMenuContainerStyle}"/>
    <Setter Property="LayoutTransform">
      <Setter.Value>
        <TransformGroup>
          <ScaleTransform ScaleX="1.25" ScaleY="1.25"/>
        </TransformGroup>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListView}">
          <ScrollViewer CanContentScroll="True" Margin="0,5,0,-25"
              VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
            <ScrollViewer.OpacityMask >
              <ImageBrush ImageSource="Home_screen_fade.png"/>
            </ScrollViewer.OpacityMask>
            <ItemsPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
          </ScrollViewer>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <VirtualizingStackPanel x:Name="GridItemsHost" Orientation="Vertical" IsItemsHost="True" HorizontalAlignment="Center" LoopScroll="False"/>
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  
  <!-- ************************************** Playlist ************************************************ -->

  <Style x:Key="RemoveButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Grid.RenderTransform>
            <Control Style="{ThemeResource ButtonControlStyle}"
                VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
            <Path x:Name="Cross1"
                VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                Margin="10" Stretch="Fill"
                Stroke="{ThemeResource DeleteCrossColor}" StrokeThickness="2" Data="M2,2 L23,23 z"/>
            <Path x:Name="Cross2"
                VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                Margin="10" Stretch="Fill"
                Stroke="{ThemeResource DeleteCrossColor}" StrokeThickness="2" Data="M2,23 L23,2 z"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Focused_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Pressed_BeginStoryboard" Storyboard="{ThemeResource PressedButtonStoryboard}"
                    HandoffBehavior="TemporaryReplace"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>



  <Style x:Key="PlaylistItemContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListViewItem}">
          <Button x:Name="ItemButton"
              Style="{ThemeResource ButtonWideStyle}" Context="{Binding}"
              VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
              Command="{DynamicResource ResourceKey=Select_Command}">
            <Button.Triggers>
              <Trigger Property="HasFocus" Value="True">
                <Setter TargetName="ItemNameLabel" Property="Scroll" Value="Auto"/>
              </Trigger>
            </Button.Triggers>
          </Button>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="PlaylistMoveUpButtonStyle" TargetType="{x:Type Button}" BasedOn="{ThemeResource ArrowButtonUpStyle}"/>

  <Style x:Key="PlaylistMoveDownButtonStyle" TargetType="{x:Type Button}" BasedOn="{ThemeResource ArrowButtonDownStyle}"/>

  <Style x:Key="EditPlaylistItemContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListViewItem}">
          <Border Background="{StaticResource ButtonBackgroundFill}" CornerRadius="{ThemeResource TextBoxCornerRadius}">
            <Grid x:Name="ParentPanel" Margin="5,2,2,2">
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
              </Grid.ColumnDefinitions>
              <ContentPresenter x:Name="PlaylistItemData" Grid.Column="0" Grid.Row="0" Margin="0,0,10,0"
                  VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
              <Button x:Name="MoveUpButton" Grid.Column="1" Grid.Row="0" Margin="3" Width="30" Height="30"
                  VerticalAlignment="Center" HorizontalAlignment="Center"
                  Style="{ThemeResource PlaylistMoveUpButtonStyle}" Context="{Binding}"
                  Command="{DynamicResource ResourceKey=MoveUp_Command}"
                  SetFocus="{Binding Path=AdditionalProperties[IsUpButtonFocused],Mode=OneTime}"/>
              <Button x:Name="MoveDownButton" Grid.Column="2" Grid.Row="0" Margin="3" Width="30" Height="30"
                  VerticalAlignment="Center" HorizontalAlignment="Center"
                  Style="{ThemeResource PlaylistMoveDownButtonStyle}" Context="{Binding}"
                  Command="{DynamicResource ResourceKey=MoveDown_Command}"
                  SetFocus="{Binding Path=AdditionalProperties[IsDownButtonFocused],Mode=OneTime}"/>
              <Button x:Name="RemoveButton" Grid.Column="3" Grid.Row="0" Margin="3" Width="30" Height="30"
                  VerticalAlignment="Center" HorizontalAlignment="Center"
                  Style="{ThemeResource RemoveButtonStyle}" Context="{Binding}"
                  Command="{DynamicResource ResourceKey=Remove_Command}"/>
            </Grid>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>
