<?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:system="clr-namespace:System"
    xmlns:collections="clr-namespace:MediaPortal.UI.Presentation.DataObjects;assembly=MediaPortal.UI"
    xmlns:mp_special_controls="clr-namespace:MediaPortal.UI.SkinEngine.SpecialElements.Controls"
    xmlns:fanart="clr-namespace:MediaPortal.Extensions.UserServices.FanArtService.Client;assembly=FanArtService.Client"
    xmlns:bgm="clr-namespace:MediaPortal.UiComponents.BackgroundManager.Converter;assembly=BackgroundManager"
    DependsOnStyleResources="Colors,Buttons,Consts,OtherControls,Widgets"
    >

  <!-- BackgroundManager model -->
  <Model x:Key="BackgroundManagerModel" Id="1F4CAEDE-7108-483d-B5C8-18BEC7EC58E5"/>
  <bgm:ListItemActionIdConverter x:Key="ListItemActionIdConverter"/>
  
   <!-- default brush used to paint the background of a page/window -->
	<ResourceWrapper x:Key="BackgroundBrush">
		<VisualBrush x:Name="BackdropImageBackgroundBrush">
			<VisualBrush.Visual>
				<Image x:Name="BackdropImageBackground" Stretch="Uniform" Source="{Binding Source={StaticResource BackgroundManagerModel}, Path=BackgroundImage}" />
			</VisualBrush.Visual>
		</VisualBrush>
	</ResourceWrapper>
  
  
  <!-- default brush used to paint the background of a page/window  
  <ResourceWrapper x:Key="BackgroundBrush">
    <VisualBrush>
      <VisualBrush.Visual>
        <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
          <Grid.Resources>
            <Model x:Key="FanArtBackgroundModel" Id="8F42C8E9-E8A3-475C-A50A-99E1E644DC91"/>
          </Grid.Resources>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
          </Grid.RowDefinitions>
          <Image VerticalAlignment="Stretch" Stretch="Uniform" Grid.Row="0" Grid.Column="0" Source="background.png"/
          <VisualBrush x:Name="BackdropImageBackgroundBrush">
						<VisualBrush.Visual>
						<Image x:Name="BackdropImageBackground"  VerticalAlignment="Stretch" Stretch="Uniform" Grid.Row="0" Grid.Column="0" source="{Binding Source={StaticResource BackgroundManagerModel}, Path=BackgroundImage}" />
						</VisualBrush.Visual>
					</VisualBrush>

        </Grid>
      </VisualBrush.Visual>
    </VisualBrush>
  </ResourceWrapper>
 -->
 
						
						<!--.Image VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Stretch="UniformToFill"
             Source="{Binding Converter={StaticResource ListItemActionIdConverter}, ConverterParameter=.jpg}"/-->
			
  <!-- Scaling constants -->
  <ResourceWrapper x:Key="HomeMenuItemScaleMax"        Resource="2" />
  <ResourceWrapper x:Key="HomeMenuItemInverseScaleMax" Resource="0.5" /> 
  
  <!-- Scale animation storyboard for focussed menu item on home screen -->
  <Storyboard x:Key="HoverMenuItemStoryboard" FillBehavior="HoldEnd">
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="HomeGlow" Storyboard.TargetProperty="Opacity">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.10" Value="0.75"/>
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>

  <!-- An item list container represented by a standard "Button", scrolling its "ItemLabel" label when focused -->
  <Style x:Key="MainMenuMenuItemContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListViewItem}">
          <Button Style="{ThemeResource HomeButtonStyle}" Margin="0,0,25,25"
              Command="{DynamicResource ResourceKey=Menu_Command}"
              IsEnabled="{Binding Enabled}" SetFocus="{Binding Path=Selected,Mode=OneTime}">

            <Button.Triggers>
              <Trigger Property="HasFocus" Value="True">
                
                <Trigger.EnterActions>
                  <BeginStoryboard x:Name="HomeHover_BeginStoryboard" Storyboard="{ThemeResource HoverMenuItemStoryboard}"/>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                  <StopStoryboard BeginStoryboardName="HomeHover_BeginStoryboard"/>
                </Trigger.ExitActions>

                <Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/>
                <Setter TargetName="ItemLabel" Property="Color" Value="{ThemeResource TextColor}"/>
                <Setter TargetName="HoverGlow" Property="IsVisible" Value="true"/>
              </Trigger>

            </Button.Triggers>
          </Button>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Menu template -->
  <DataTemplate x:Key="MainMenuItemDataTemplateHover">
  		<Grid x:Name="ItemControl" Margin="0,0,0,0" Width="345" Height="55">  	 <!-- Height and Width of button background picture -->
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="55"/>
        <!--RowDefinition Height="*"/-->
      </Grid.RowDefinitions>

      <!-- Light blue background fill -->
      <Rectangle Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" 
          x:Name="HomeFill" Fill="#FFFFFFFF" Opacity="0.000" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
      
      <!-- Darkened band -->
      <Rectangle Grid.Row="0" Grid.Column="0" Fill="#FF000000" Opacity="0.000" 
                 HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" />
      
      <!-- Item label -->
      <Label Grid.Row="0" Grid.Column="0" x:Name="ItemLabel" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="{Binding [Name]}" 
             FontSize="{ThemeResource BigFontSize}" FontFamily="Titan" Color="BLACK" Margin="2,2,2,2"/>
    </Grid>
  </DataTemplate>

  <Style x:Key="MainMenuScrollViewerStyle" TargetType="{x:Type ScrollViewer}">

    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollViewer}">
        
          <Grid x:Name="ScrollViewerGrid">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="20"/>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="20"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <!-- Scroll left indicator -->
        
            <Label Margin="0,0,0,0" Grid.Row="1" Grid.Column="0" Content="&lt;" FontSize="{ThemeResource BigFontSize}" Color="#00FFFFFF">
              <Label.IsVisible>
                <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1} > 0.0">
                  <TemplateBinding Path="ScrollBarXVisible"/>
                  <TemplateBinding Path="ScrollBarXKnobPos"/>
                </MultiBinding>
              </Label.IsVisible>
            </Label>

            <!-- Content -->
          
            <ScrollContentPresenter Grid.Row="1" Grid.Column="1" Grid.ZIndex="100" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                                    ActualWidth="{TemplateBinding Path=ScrollBarXSize,Mode=OneWayToSource}" Margin="40,0,10,0"/>


            <!-- Scroll right indicator -->
           
            <Label Margin="0,0,0,0" Grid.Row="1" Grid.Column="2" Content="&gt;" FontSize="{ThemeResource BigFontSize}" Color="{ThemeResource HomeNonFocusedColor}">
              <Label.IsVisible>
                <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; ({1}+{2} &lt; {3})">
                  <TemplateBinding Path="ScrollBarXVisible"/>
                  <TemplateBinding Path="ScrollBarXKnobPos"/>
                  <TemplateBinding Path="ScrollBarXKnobWidth"/>
                  <TemplateBinding Path="ScrollBarXSize"/>
                </MultiBinding>
              </Label.IsVisible>
            </Label>
            
          </Grid>
          
        </ControlTemplate>
      </Setter.Value>
    </Setter>

  </Style>

  <!-- ListView style to be used for main menu -->
  <Style x:Key="HomeMenuListViewStyle" BasedOn="{ThemeResource MainMenuListViewStyle}">
  	

  	
    <Setter Property="SelectionChanged" Value="{CommandStencil Source={StaticResource BackgroundManagerModel}, Path=SetSelectedItem}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListView}">
          <ScrollViewer CanContentScroll="True" Margin="5" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Disabled">
<!--ScrollViewer CanContentScroll="True" Margin="5" Style="{ThemeResource MainMenuScrollViewerStyle}"-->
            <ItemsPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
          </ScrollViewer>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemTemplate" Value="{ThemeResource MainMenuItemDataTemplateHover}"/>
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>

          <StackPanel x:Name="ListItemsHost" IsItemsHost="True" Orientation="Horizontal" HorizontalAlignment="Center"/>

          <!--<WrapPanel x:Name="ListItemsHost" IsItemsHost="True" />-->

        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemContainerStyle" Value="{ThemeResource MainMenuMenuItemContainerStyle}"/>							
  </Style>

  <!-- Special style for "hidden menu", mainly to use another color -->
  <Style x:Key="MenuItemContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListViewItem}">
          <Button Style="{ThemeResource MenuButtonWideStyle}" Margin="5"
              Command="{DynamicResource ResourceKey=Menu_Command}"
              SetFocus="{Binding Path=Selected,Mode=OneTime}">
            <Button.IsEnabled>
              <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                <!-- Consider the item's enabled state -->
                <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="IsEnabled"/>
                <!-- In combination with the parent ListView's enabled state --> 
                <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListView}}" Path="IsEnabled"/>
              </MultiBinding>
            </Button.IsEnabled>
            <Button.Triggers>
              <Trigger Property="HasFocus" Value="True">
                <Setter TargetName="ItemLabel" Property="Scroll" Value="Auto"/>
                <Setter TargetName="ItemLabel" Property="Color" Value="{ThemeResource TextColor}"/>
              </Trigger>
            </Button.Triggers>
          </Button>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  
  <DataTemplate x:Key="MenuItemDataTemplate">
    <DockPanel x:Name="ItemControl" LastChildFill="False">
      <Label x:Name="ItemLabel" DockPanel.Dock="Center" Content="{Binding [Name]}"
          HorizontalAlignment="Left" VerticalAlignment="Center"
          Color="{ThemeResource MenuTextColor}"/>
    </DockPanel>
  </DataTemplate>
  
  <Style x:Key="MenuListViewStyle" BasedOn="{ThemeResource MainMenuListViewStyle}">
    <Setter Property="ItemTemplate" Value="{ThemeResource MenuItemDataTemplate}"/>
    <Setter Property="ItemContainerStyle" Value="{ThemeResource MenuItemContainerStyle}"/>
  </Style>

  <Style x:Key="NewPlayerControlGroupBoxStyle">
    <Setter Property="BorderBrush" Value="{ThemeResource ReflexionBorderStroke}"/>
    <Setter Property="BorderThickness" Value="{ThemeResource DefaultPlayerControlBorderThickness}"/>
    <Setter Property="CornerRadius" Value="{ThemeResource DefaultPlayerControlCornerRadius}"/>
    <Setter Property="HeaderColor" Value="{ThemeResource PlayerControlTitleColor}"/>
    <Setter Property="FontSize" Value="{ThemeResource PlayerControlFontSize}"/>
  </Style>


  <!-- Translate animation storyboard for bottom player control bar -->
  <Storyboard x:Key="ShowBottomPlayerBarStoryboard" FillBehavior="HoldEnd">
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="BottomPlayerControlBar" Storyboard.TargetProperty="RenderTransform.Children[0].Y">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="110"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.50" Value="0"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames FillBehavior="HoldEnd" Storyboard.TargetName="PrimaryPC" Storyboard.TargetProperty="Opacity">
      <SplineDoubleKeyFrame KeyTime="00:00:00.50" Value="0"/>
      <SplineDoubleKeyFrame KeyTime="00:00:01.00" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames FillBehavior="HoldEnd" Storyboard.TargetName="SecondaryPC" Storyboard.TargetProperty="Opacity">
      <SplineDoubleKeyFrame KeyTime="00:00:00.50" Value="0"/>
      <SplineDoubleKeyFrame KeyTime="00:00:01.00" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>
  
  <!-- Player control styles -->
  <Style x:Key="NewNavigationScreenPlayerControlStyle" TargetType="{x:Type mp_special_controls:PlayerControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type mp_special_controls:PlayerControl}">
          <Grid x:Name="PCGroupBox" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto"/> <!-- Media thumbnail -->
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!-- Background of player control panel-->
            <Rectangle x:Name="PCBackground" Grid.ColumnSpan="2" Fill="{ThemeResource PlayerControlBackgroundColor}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RadiusX="30" RadiusY="30" />
            <Rectangle Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RadiusX="30" RadiusY="30" >
              <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                  <GradientStop Color="{ThemeResource CurrentPlayerControlBackgroundColor2}" Offset="0"/>
                  <GradientStop Color="{ThemeResource CurrentPlayerControlBackgroundColor3}" Offset="0.874"/>
                </LinearGradientBrush>
              </Rectangle.Fill>
            </Rectangle>
            
            <Image x:Name="ItemTypeImage" Grid.Row="0" Grid.Column="0" Stretch="Uniform" 
                    Source="{Binding MediaItem}" Height="120" Margin="40,0,20,0"/>

            <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Vertical" Margin="10">
              <Grid x:Name="MediaInfoPanel" Margin="5" HorizontalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="*"/>
                  <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <!--<Grid x:Name="PlayerStatePanel" Grid.Row="0" Grid.Column="0">
                  <Control x:Name="StatePlay" IsVisible="{Binding IsPlaying}" Template="{ThemeResource PlayControlTemplate}"
                      VerticalAlignment="Center"/>
                  <Control x:Name="StatePause" IsVisible="{Binding IsPaused}" Template="{ThemeResource PauseControlTemplate}"
                      VerticalAlignment="Center"/>
                  <Control x:Name="StateForward" IsVisible="{Binding IsSeekingForward}" Template="{ThemeResource ForwardControlTemplate}"
                      VerticalAlignment="Center"/>
                  <Control x:Name="StateRewind" IsVisible="{Binding IsSeekingBackward}" Template="{ThemeResource RewindControlTemplate}"
                      VerticalAlignment="Center"/>
                  <Label x:Name="SeekHint" FontSize="{ThemeResource TinyFontSize}" Content="{Binding SeekHint}" Color="{ThemeResource TextColor}"/>
                </Grid>-->
                <Label x:Name="MediaItemTitle" Grid.Row="0" Grid.Column="1" Color="{ThemeResource PlayerControlMediaItemColor}" FontSize="{ThemeResource SmallFontSize}"
                    Content="{Binding MediaItemTitle}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Scroll="Auto">
                  <Label.Triggers>
                    <DataTrigger Binding="{Binding IsPlayerPresent}" Value="False">
                      <Setter Property="Color" Value="{ThemeResource PlayerControlInactiveMediaItemColor}"/>
                    </DataTrigger>
                  </Label.Triggers>
                </Label>
                <Label x:Name="PlayerTitle" Grid.Row="0" Grid.Column="2" Color="{ThemeResource HomeNonFocusedColor}" FontSize="{ThemeResource SmallFontSize}"
                    Content="{Binding Title}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="20,0,0,0"/>
              </Grid>
              <StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal" Margin="0">
                <!-- Workaround to avoid layouting problems with LayoutTransform -->
                <StackPanel x:Name="MouseControlsPanel" Orientation="Horizontal" IsVisible="True">
                  <!--{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>
                <StackPanel.LayoutTransform>
                  <TransformGroup>
                    <ScaleTransform ScaleX="0.5" ScaleY="0.5"/>
                  </TransformGroup>
                </StackPanel.LayoutTransform>
              </StackPanel>
            </StackPanel>
          </Grid>

          <ControlTemplate.Triggers>
            <Trigger Property="IsCurrentPlayer" Value="True">
              <Setter TargetName="PCBackground" Property="Fill" Value="{ThemeResource CurrentPlayerControlBackgroundColor1}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- ****************************** Workflow navigation bar ********************************** -->

  <Storyboard x:Key="NewFocusedNavbarContainerStoryboard" FillBehavior="HoldEnd">
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="WorkflowNavigationBarItemContainer_LineLeft" Storyboard.TargetProperty="Fill">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource WorkflowNavigationBarItemContainerFillColor}"/>
      <SplineColorKeyFrame KeyTime="{ThemeResource WorkflowNavigationBarFocusTime}" Value="{ThemeResource FocusedWorkflowNavigationBarItemContainerFillColor}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="WorkflowNavigationBarItemContainer_ArrowLeft" Storyboard.TargetProperty="Fill">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource WorkflowNavigationBarItemContainerFillColor}"/>
      <SplineColorKeyFrame KeyTime="{ThemeResource WorkflowNavigationBarFocusTime}" Value="{ThemeResource FocusedWorkflowNavigationBarItemContainerFillColor}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="WorkflowNavigationBarItemContainer_Center_Back" Storyboard.TargetProperty="Fill">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource WorkflowNavigationBarItemContainerFillColor}"/>
      <SplineColorKeyFrame KeyTime="{ThemeResource WorkflowNavigationBarFocusTime}" Value="{ThemeResource FocusedWorkflowNavigationBarItemContainerFillColor}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="WorkflowNavigationBarItemContainer_ArrowRight" Storyboard.TargetProperty="Fill">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource WorkflowNavigationBarItemContainerFillColor}"/>
      <SplineColorKeyFrame KeyTime="{ThemeResource WorkflowNavigationBarFocusTime}" Value="{ThemeResource FocusedWorkflowNavigationBarItemContainerFillColor}"/>
    </ColorAnimationUsingKeyFrames>
  </Storyboard>
  
  <!-- Container style for the entries in the workflow navigation bar -->
  <Style x:Key="NewWorkflowNavigationBarContainerStyle" BasedOn="{ThemeResource DefaultItemContainerStyle}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListViewItem}">
          <!-- Available data in the given ListViewItem:
               - AdditionalProperties[IsFirst] is true for the first item
               - Executing the Command will navigate the workflow to the underlaying workflow state
          -->
          <Button Command="{Binding Command}" Style="{ThemeResource EmptyStyle}">
            <Button.TemplateControl>
              <Grid x:Name="WorkflowItemGrid" Opacity="0.5">
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="15"/>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="15"/>
                </Grid.ColumnDefinitions>
                <Path x:Name="WorkflowNavigationBarItemContainer_LineLeft" Grid.Row="0" Grid.Column="0" Stretch="Fill"
                    IsVisible="{Binding AdditionalProperties[IsFirst]}"
                    Stroke="{ThemeResource WorkflowNavigationBarItemContainerStrokeColor}"
                    Fill="{ThemeResource WorkflowNavigationBarItemContainerFillColor}"
                    Data="M20,20 L0,20 0,0 20,0"/>
                <Path x:Name="WorkflowNavigationBarItemContainer_ArrowLeft" Grid.Row="0" Grid.Column="0" Stretch="Fill"
                    IsVisible="{Binding !AdditionalProperties[IsFirst]}"
                    Stroke="{ThemeResource WorkflowNavigationBarItemContainerStrokeColor}"
                    Fill="{ThemeResource WorkflowNavigationBarItemContainerFillColor}"
                    Data="M30,20 L0,20 0,18 20,10 0,2 0,0 30,0"/>
                <Path x:Name="WorkflowNavigationBarItemContainer_Center_Back" Grid.Row="0" Grid.Column="1" Stretch="Fill"
                    Fill="{ThemeResource WorkflowNavigationBarItemContainerFillColor}"
                    Data="M0,0 L100,0 100,20 0,20 z"/>
                <Path x:Name="WorkflowNavigationBarItemContainer_Center_Border" Grid.Row="0" Grid.Column="1" Stretch="Fill"
                    Stroke="{ThemeResource WorkflowNavigationBarItemContainerStrokeColor}"
                    Data="M0,0 L100,0 M100,20 L0,20"/>
                <Path x:Name="WorkflowNavigationBarItemContainer_ArrowRight" Grid.Row="0" Grid.Column="2" Stretch="Fill"
                    Stroke="{ThemeResource WorkflowNavigationBarItemContainerStrokeColor}"
                    Fill="{ThemeResource WorkflowNavigationBarItemContainerFillColor}"
                    Data="M0,0 L10,0 10,2 30,10 10,18 10,20 0,20"/>
                <ContentPresenter Grid.Row="0" Grid.Column="1" x:Name="WorkflowNavibationItemContentPresenter" HorizontalAlignment="Stretch"/>
              </Grid>
            </Button.TemplateControl>
            <Button.Triggers>
              <Trigger Property="HasFocus" Value="True">
                <Setter TargetName="WorkflowItemGrid" Property="Opacity" Value="1"/>
                <Trigger.EnterActions>
                  <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource NewFocusedNavbarContainerStoryboard}"/>
                </Trigger.EnterActions>
                <Trigger.ExitActions>
                  <StopStoryboard BeginStoryboardName="Focused_BeginStoryboard"/>
                </Trigger.ExitActions>
              </Trigger>
            </Button.Triggers>
          </Button>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>


  <!-- Data template for contents of workflow navigation bar entries -->
  <DataTemplate x:Key="NewWorkflowNavigationBarItemDataTemplate" DataType="{x:Type collections:ListItem}">
    <DockPanel x:Name="ItemControl" LastChildFill="True">
      <Label x:Name="ItemLabel" DockPanel.Dock="Center" Margin="2" Content="{Binding [Name]}" Color="{ThemeResource WorkflowNavigationBarFontColor}"/>
    </DockPanel>
  </DataTemplate>

  <!-- Control which is used to symbolize the ellipsis of some entries when the workflow navigation bar is too long for the available space -->
  <Style x:Key="NewWorkflowNavigationBarEllipsisControlStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Label Content="..." Margin="10,2,10,2" Color="{ThemeResource WorkflowNavigationBarFontColor}"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="NewWorkflowNavigationBarListViewStyle" TargetType="{x:Type ListView}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <ItemsPresenter Margin="5"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemTemplate" Value="{ThemeResource NewWorkflowNavigationBarItemDataTemplate}"/>
    <Setter Property="ItemContainerStyle" Value="{ThemeResource NewWorkflowNavigationBarContainerStyle}"/>
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <mp_special_controls:WorkflowNavigationBarPanel x:Name="WorkflowNavigationBarItemsHost" IsItemsHost="True"
              Orientation="Horizontal"
              EllipsisControlStyle="{ThemeResource NewWorkflowNavigationBarEllipsisControlStyle}"/>
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="NewWorkflowNavigationBarStyle" TargetType="{x:Type mp_special_controls:WorkflowNavigationBar}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <ListView x:Name="WorkflowNavigationBarListView" ItemsSource="{TemplateBinding NavigationItems}" Style="{ThemeResource NewWorkflowNavigationBarListViewStyle}"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>



</ResourceDictionary>
