<?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:mp_special_controls="clr-namespace:MediaPortal.UI.SkinEngine.SpecialElements.Controls"
    DependsOnStyleResources="Colors,Graphics,Consts,Widgets"
    >

  <!-- ***************************** Storyboards ******************************** -->

  <ResourceWrapper x:Key="SquareButtonZoomCoefficient" Resource="1.1"/>
  <ResourceWrapper x:Key="WideButtonZoomCoefficientX" Resource="1.02"/>
  <ResourceWrapper x:Key="WideButtonZoomCoefficientY" Resource="1.1"/>

  <!-- Base storyboard which shows an animation when a button has focus -->
  <Storyboard x:Key="FocusedButtonStoryboard_Base" FillBehavior="Stop">
    <PointAnimationUsingKeyFrames RepeatBehavior="Forever" AutoReverse="true" BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.GradientOrigin">
      <SplinePointKeyFrame KeyTime="00:00:00" Value="0.5,1.709"/>
      <SplinePointKeyFrame KeyTime="00:00:02" Value="0.5,0.899"/>
      <SplinePointKeyFrame KeyTime="00:00:04" Value="0.5,1.719"/>
    </PointAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames RepeatBehavior="Forever" AutoReverse="true" BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.GradientStops[1].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource FocusedButtonGradientDarkColor}"/>
      <SplineColorKeyFrame KeyTime="00:00:02" Value="{ThemeResource FocusedButtonGradientDarkColor}"/>
      <SplineColorKeyFrame KeyTime="00:00:04" Value="{ThemeResource FocusedButtonGradientDarkColor}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames RepeatBehavior="Forever" AutoReverse="true" BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.GradientStops[0].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource FocusedButtonGradientLightColor}"/>
      <SplineColorKeyFrame KeyTime="00:00:02" Value="{ThemeResource FocusedButtonGradientLighterColor}"/>
      <SplineColorKeyFrame KeyTime="00:00:04" Value="{ThemeResource FocusedButtonGradientLightColor}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames RepeatBehavior="Forever" AutoReverse="true" BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Stroke.Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource HighlightButtonStrokeColor}"/>
      <SplineColorKeyFrame KeyTime="00:00:02" Value="{ThemeResource HighlightButtonStrokeColor}"/>
      <SplineColorKeyFrame KeyTime="00:00:04" Value="{ThemeResource HighlightButtonStrokeColor}"/>
    </ColorAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" AutoReverse="true" BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.RelativeTransform.Children[0].ScaleX">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.26"/>
      <SplineDoubleKeyFrame KeyTime="00:00:02" Value="0.8"/>
      <SplineDoubleKeyFrame KeyTime="00:00:04" Value="1.335"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" AutoReverse="true" BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.RelativeTransform.Children[1].X">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-0.009"/>
      <SplineDoubleKeyFrame KeyTime="00:00:02" Value="0.019"/>
      <SplineDoubleKeyFrame KeyTime="00:00:04" Value="0.027"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" AutoReverse="true" BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.RelativeTransform.Children[1].Y">
      <SplineDoubleKeyFrame KeyTime="00:00:02" Value="0.119"/>
      <SplineDoubleKeyFrame KeyTime="00:00:04" Value="-0.006"/>
    </DoubleAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonBase" Storyboard.TargetProperty="Fill">
      <SplineColorKeyFrame KeyTime="00:00:00.1000000" Value="{ThemeResource ButtonBackgroundFocusFill}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonUpperShine" Storyboard.TargetProperty="Fill.GradientStops[0].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource ShineGradientEndColor}"/>
      <SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="{ThemeResource ShineGradientStartColor}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonLowerShine" Storyboard.TargetProperty="Fill.GradientStops[0].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource ShineGradientEndColor}"/>
      <SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="{ThemeResource ShineGradientStartColor}"/>
    </ColorAnimationUsingKeyFrames>
  </Storyboard>

  <!-- Storyboard for buttons which are focused and which are almost square, e.g. radio buttons.
       This animation scales the button in x- and y-direction with the same factor. -->
  <Storyboard x:Key="FocusedButtonStoryboard" FillBehavior="Stop">
    <StaticResource ResourceKey="FocusedButtonStoryboard_Base"/>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="GrowControl" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.1" Value="{ThemeResource SquareButtonZoomCoefficient}"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="GrowControl" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.1" Value="{ThemeResource SquareButtonZoomCoefficient}"/>
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>

  <!-- Storyboard for wide buttons which are focused, e.g. text buttons.
       This animation scales the button in x- and y-direction with different factors. -->
  <Storyboard x:Key="FocusedButtonWideStoryboard_GrowOnly" FillBehavior="HoldEnd">
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="GrowControl" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> 						<!--Animation: Sretching factor during selection-->
      <SplineDoubleKeyFrame KeyTime="00:00:00.1" Value="{ThemeResource WideButtonZoomCoefficientX}"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="GrowControl" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.1" Value="{ThemeResource WideButtonZoomCoefficientY}"/>
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>

  <Storyboard x:Key="FocusedButtonWideStoryboard" FillBehavior="HoldEnd">
    <StaticResource ResourceKey="FocusedButtonStoryboard_Base"/>
    <StaticResource ResourceKey="FocusedButtonWideStoryboard_GrowOnly"/>

    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Opacity">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.1" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>

  <Storyboard x:Key="FocusedMenuButtonWideStoryboard" FillBehavior="HoldEnd">
    <StaticResource ResourceKey="FocusedButtonWideStoryboard_GrowOnly"/>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Opacity">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.1" Value="1"/>
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>

  <!-- Base storyboard which shows an animation when a button is pressed -->
  <Storyboard x:Key="PressedButtonStoryboard_Base" FillBehavior="HoldEnd">
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.GradientStops[1].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource PressedButtonGradientDark2Color}"/>
      <SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="{ThemeResource PressedButtonGradientDark1Color}"/>
      <SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="{ThemeResource PressedButtonGradientDark2Color}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.GradientStops[0].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource PressedButtonGradientLight2Color}"/>
      <SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="{ThemeResource PressedButtonGradientLight1Color}"/>
      <SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="{ThemeResource PressedButtonGradientLight2Color}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Stroke.Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource HighlightButtonStrokeColor}"/>
      <SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="{ThemeResource HighlightButtonStrokeColor}"/>
      <SplineColorKeyFrame KeyTime="00:00:00.4000000" Value="{ThemeResource HighlightButtonStrokeColor}"/>
    </ColorAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.RelativeTransform.Children[0].ScaleX">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.335"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1.286"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="1.286"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.RelativeTransform.Children[0].ScaleY">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.582"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1.526"/>
      <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="1.526"/>
    </DoubleAnimationUsingKeyFrames>
    <PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonControlRectangle" Storyboard.TargetProperty="Fill.GradientOrigin">
      <SplinePointKeyFrame KeyTime="00:00:00" Value="0.502,1.027"/>
      <SplinePointKeyFrame KeyTime="00:00:00.2000000" Value="0.5,1.026"/>
      <SplinePointKeyFrame KeyTime="00:00:00.4000000" Value="0.5,1.026"/>
    </PointAnimationUsingKeyFrames>
  </Storyboard>

  <!-- Storyboard for buttons which are pressed and which are almost square, e.g. radio buttons.
       This animation scales the button in x- and y-direction with the same factor. -->
  <Storyboard x:Key="PressedButtonStoryboard" FillBehavior="HoldEnd">
    <StaticResource ResourceKey="PressedButtonStoryboard_Base"/>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="GrowControl" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="{ThemeResource SquareButtonZoomCoefficient}"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="GrowControl" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="{ThemeResource SquareButtonZoomCoefficient}"/>
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>

  <!-- Storyboard for wide buttons which are pressed, e.g. text buttons.
       This animation scales the button in x- and y-direction with different factors. -->
  <Storyboard x:Key="PressedButtonWideStoryboard_GrowOnly" FillBehavior="HoldEnd">
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="GrowControl" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleX">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="{ThemeResource WideButtonZoomCoefficientX}"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" FillBehavior="HoldEnd" Storyboard.TargetName="GrowControl" Storyboard.TargetProperty="RenderTransform.Children[0].ScaleY">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="{ThemeResource WideButtonZoomCoefficientY}"/>
    </DoubleAnimationUsingKeyFrames>
  </Storyboard>

  <Storyboard x:Key="PressedButtonWideStoryboard" FillBehavior="HoldEnd">
    <StaticResource ResourceKey="PressedButtonStoryboard_Base"/>
    <StaticResource ResourceKey="PressedButtonWideStoryboard_GrowOnly"/>
  </Storyboard>

  <Storyboard x:Key="PressedMenuButtonWideStoryboard" FillBehavior="HoldEnd">
    <StaticResource ResourceKey="PressedButtonWideStoryboard_GrowOnly"/>
  </Storyboard>

  <!-- Storyboard whichs turns the background to be transparent for disabled buttons -->
  <Storyboard x:Key="DisabledButtonStoryboard" RepeatBehavior="Forever" Duration="00:00:01">
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonBase" Storyboard.TargetProperty="Fill">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource ButtonBackgroundDisabledFill}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonBase" Storyboard.TargetProperty="Stroke.GradientStops[0].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource ButtonBackgroundDisabledFill}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonBase" Storyboard.TargetProperty="Stroke.GradientStops[1].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource ButtonBackgroundDisabledFill}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonBase" Storyboard.TargetProperty="Stroke.GradientStops[2].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource ButtonBackgroundDisabledFill}"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonBase" Storyboard.TargetProperty="Stroke.GradientStops[3].Color">
      <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource ButtonBackgroundDisabledFill}"/>
    </ColorAnimationUsingKeyFrames>
  </Storyboard>


  <Storyboard x:Key="FocusedOSDButtonStoryboard" FillBehavior="HoldEnd">
    <StaticResource ResourceKey="FocusedButtonWideStoryboard_GrowOnly"/>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="ButtonBackground" Storyboard.TargetProperty="Fill.GradientStops[0].Color">
      <SplineColorKeyFrame KeyTime="00:00:00"    Value="#8C221E1F"/>
      <SplineColorKeyFrame KeyTime="00:00:00.20" Value="#FFFFFFFF"/>
    </ColorAnimationUsingKeyFrames>
    <ColorAnimationUsingKeyFrames Storyboard.TargetName="ButtonBackground" Storyboard.TargetProperty="Fill.GradientStops[1].Color">
      <SplineColorKeyFrame KeyTime="00:00:00"    Value="#00221E1F"/>
      <SplineColorKeyFrame KeyTime="00:00:00.20" Value="#CC288393"/>
    </ColorAnimationUsingKeyFrames>
  </Storyboard>


  <!-- ************************* Control styles for buttons ************************* -->

  <ResourceWrapper x:Key="ButtonMask_Image">
    <ImageBrush ImageSource="homebutton_mask.png" Stretch="Fill"/>			  <!-- Adjusted: Original is Strech="Uniform" -->
  </ResourceWrapper>

  <!-- Home items button style -->
  <Style x:Key="HomeButtonControlStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
	<Image x:Name="HoverGlow" Source="basichome_button_focus.png" Margin="-45" IsVisible="false" Opacity="0.6" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  
  <!-- Flat button style, used under glass overlay -->
  <Style x:Key="FlatButtonControlStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <DockPanel Name="ButtonControlRectangle">
            <Rectangle DockPanel.Dock="Center" Name="ButtonBase" Fill="{StaticResource ButtonBackgroundFill}" />
            <Rectangle DockPanel.Dock="Center" Name="ButtonLowerShine" Fill="{StaticResource LowerShineGradientAnimated}" />
            <Rectangle DockPanel.Dock="Center" Name="ButtonUpperShine" Fill="{StaticResource UpperShineGradientAnimated}" />
          </DockPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- Main button style -->
  <Style x:Key="ButtonControlStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <DockPanel Name="ButtonControlRectangle" Margin="2">
            <Rectangle DockPanel.Dock="Center" x:Name="ButtonBaseBackground" StrokeLineJoin="Miter" RadiusX="{StaticResource ButtonRadius}" RadiusY="{StaticResource ButtonRadius}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                  <GradientStop Color="#4CFFFFFF" Offset="0"/>
                  <GradientStop Color="#4C2D2D2D" Offset="0.672"/>
                </LinearGradientBrush>
              </Rectangle.Fill>
            </Rectangle>
            <Rectangle DockPanel.Dock="Center" RadiusX="{StaticResource ButtonRadius}" RadiusY="{StaticResource ButtonRadius}" Name="ButtonLowerShine" Fill="{StaticResource LowerShineGradientAnimated}" />
            <Rectangle DockPanel.Dock="Center" RadiusX="{StaticResource ButtonRadius}" RadiusY="{StaticResource ButtonRadius}" Name="ButtonUpperShine" Fill="{StaticResource UpperShineGradientAnimated}" />
            <Rectangle DockPanel.Dock="Center" x:Name="ButtonBase" StrokeLineJoin="Miter" RadiusX="{StaticResource ButtonRadius}" RadiusY="{StaticResource ButtonRadius}"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                       Fill="#A0000000" Stroke="{ThemeResource ReflexionBorderStroke}"/>
          </DockPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- "Hidden Menu" button style -->
  <Style x:Key="MenuButtonControlStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle Name="ButtonControlRectangle" RadiusY="20" RadiusX="20" Opacity="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FF23C1FF" Offset="0"/>
                <GradientStop Color="#FF009AD5" Offset="0.5"/>
                <GradientStop Color="#FF008DC4" Offset="0.5"/>
                <GradientStop Color="#FF00719D" Offset="1"/>
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="EmptyButtonControlStyle" TargetType="{x:Type Control}">
  </Style>

  <Style x:Key="ProgramGuideRowHeaderButtonControlStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <DockPanel Name="ButtonControlRectangle">
            <Rectangle DockPanel.Dock="Center" RadiusX="0" RadiusY="0" Name="ButtonBase" Fill="#F0303030" Stroke="{ThemeResource ReflexionBorderStroke}"/>
            <Rectangle DockPanel.Dock="Center" RadiusX="0" RadiusY="0" Name="ButtonLowerShine" Fill="{StaticResource LowerShineGradientAnimated}" />
            <Rectangle DockPanel.Dock="Center" RadiusX="0" RadiusY="0" Name="ButtonUpperShine" Fill="{StaticResource UpperShineGradientAnimated}" />
          </DockPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ProgramGuideButtonControlStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <DockPanel Name="ButtonControlRectangle">
            <Rectangle DockPanel.Dock="Center" RadiusX="0" RadiusY="0" Name="ButtonBase" Fill="#E0101010" Stroke="{ThemeResource ReflexionBorderStroke}"/>
            <Rectangle DockPanel.Dock="Center" RadiusX="0" RadiusY="0" Name="ButtonLowerShine" Fill="{StaticResource LowerShineGradientAnimated}" />
            <Rectangle DockPanel.Dock="Center" RadiusX="0" RadiusY="0" Name="ButtonUpperShine" Fill="{StaticResource UpperShineGradientAnimated}" />
            <Rectangle DockPanel.Dock="Center" Name="ButtonOverlay" Fill=""/>
          </DockPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="OSDButtonControlStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <DockPanel Name="ButtonControlRectangle">
            <Ellipse DockPanel.Dock="Center" x:Name="ButtonBackground" Margin="0,2,0,1">
              <Ellipse.Fill>
                <RadialGradientBrush Center="0.5,0.5" GradientOrigin="0.25,0.3">
                  <GradientStop Color="#FF626262" Offset="0.967"/>
                  <GradientStop Color="#FFAAAAAF"/>
                </RadialGradientBrush>
              </Ellipse.Fill>
            </Ellipse>
            <Ellipse DockPanel.Dock="Center" x:Name="ButtonBorderShadow" StrokeThickness="5" Stroke="#7E000000" Margin="1,4,0,1"/>
            <Ellipse DockPanel.Dock="Center" x:Name="ButtonBorder" StrokeThickness="5" Margin="0,3,0,1">
              <Ellipse.Stroke>
                <RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.3,0.3">
                  <GradientStop Color="Black" Offset="0"/>
                  <GradientStop Color="#FFA5A5A5" Offset="1"/>
                </RadialGradientBrush>
              </Ellipse.Stroke>
            </Ellipse>
          </DockPanel>

          <!--<DockPanel Name="ButtonControlRectangle">
            <Rectangle DockPanel.Dock="Center" RadiusX="2" RadiusY="2" Name="ButtonBase" Fill="#E0203040" />
            <Rectangle DockPanel.Dock="Center" RadiusX="2" RadiusY="2" Name="ButtonLowerShine" Fill="{StaticResource LowerShineGradientAnimated}" />
            <Rectangle DockPanel.Dock="Center" RadiusX="2" RadiusY="2" Name="ButtonUpperShine" Fill="{StaticResource UpperShineGradientAnimated}" />
          </DockPanel>-->
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="RadioButtonControlStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle x:Name="ButtonControlRectangle" Stroke="{ThemeResource ButtonStrokeColor}" RadiusX="5" RadiusY="5" Width="18" Height="18">
            <Rectangle.Fill>
              <RadialGradientBrush GradientOrigin="0.85,0.82">
                <RadialGradientBrush.RelativeTransform>
                  <TransformGroup>
                    <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.335" ScaleY="1.582"/>
                    <TranslateTransform X="0.027" Y="-0.006"/>
                  </TransformGroup>
                </RadialGradientBrush.RelativeTransform>
                <GradientStop Color="{ThemeResource ButtonGradientLightColor}" Offset="0"/>
                <GradientStop Color="{ThemeResource ButtonGradientDarkColor}" Offset="1"/>
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- ***************************** Standard buttons ******************************** -->

  <Style x:Key="DefaultButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5" Margin="0,1,0,1">
            <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"/>
            <ContentPresenter x:Name="ButtonContentPresenter" Margin="10,5,10,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="HomeButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5" Margin="0,1,0,1">
            <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 HomeButtonControlStyle}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
            <ContentPresenter x:Name="ButtonContentPresenter" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                OpacityMask="{StaticResource ButtonMask_Image}"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonWideStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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 PressedButtonWideStoryboard}"
                    HandoffBehavior="TemporaryReplace"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MenuButtonWideStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5" Margin="0,1,0,1">
            <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 MenuButtonControlStyle}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
            <ContentPresenter x:Name="ButtonContentPresenter" Margin="30,5,30,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedMenuButtonWideStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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 PressedMenuButtonWideStoryboard}"
                    HandoffBehavior="TemporaryReplace"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  
  <Style x:Key="ButtonWideStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5" Margin="0,1,0,1">
            <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"/>
            <ContentPresenter x:Name="ButtonContentPresenter" Margin="10,5,10,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonWideStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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 PressedButtonWideStoryboard}"
                    HandoffBehavior="TemporaryReplace"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ButtonWideStyle_GrowOnly" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5" Margin="0,1,0,1">
            <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 EmptyButtonControlStyle}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
            <ContentPresenter x:Name="ButtonContentPresenter" Margin="10,5,10,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonWideStoryboard_GrowOnly}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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 PressedButtonWideStoryboard_GrowOnly}"
                    HandoffBehavior="TemporaryReplace"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="GlobalButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5" Margin="0,1,0,1">
            <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"/>
            <Control x:Name="ContentControl" Template="{DynamicResource ResourceKey=ContentControlTemplate}" 
                       VerticalAlignment="Stretch" HorizontalAlignment="Stretch"  Margin="10,5,10,5"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonWideStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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 PressedButtonWideStoryboard}"
                    HandoffBehavior="TemporaryReplace"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="WizardButtonStyle" BasedOn="{ThemeResource ButtonWideStyle}" TargetType="{x:Type Button}">
    <Setter Property="HorizontalAlignment" Value="Stretch"/>
  </Style>

  <Style x:Key="DialogButtonStyle" BasedOn="{ThemeResource ButtonWideStyle}" TargetType="{x:Type Button}">
    <Setter Property="MinWidth" Value="{ThemeResource DialogButtonMinWidth}"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>
  </Style>

  <!-- ***************************** Radio buttons ******************************** -->

  <Style x:Key="DefaultRadioButtonStyle" TargetType="{x:Type RadioButton}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Grid Margin="2">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Control x:Name="GrowControl" Grid.Column="0" Grid.Row="0" Style="{ThemeResource RadioButtonControlStyle}"
                VerticalAlignment="Center" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5">
              <Control.RenderTransform>
                <TransformGroup>
                  <ScaleTransform ScaleX="1" ScaleY="1"/>
                </TransformGroup>
              </Control.RenderTransform>
            </Control>
            <Ellipse x:Name="InnerCircle" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center"
                Width="5" Height="5" Fill="{ThemeResource ControlHandleColor}" Visibility="Hidden"/>
            <ContentPresenter x:Name="RadioButtonContentPresenter" Grid.Column="1" Grid.Row="0" Margin="10,0,10,0"
                HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
              <Setter TargetName="InnerCircle" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="RadioButtonLeftStyle" TargetType="{x:Type RadioButton}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Grid Margin="0,2,0,2">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <ContentPresenter x:Name="RadioButtonContentPresenter" Grid.Column="0" Grid.Row="0" Margin="10,0,10,0"
                HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
            <Control x:Name="GrowControl" Grid.Column="1" Grid.Row="0" Style="{ThemeResource RadioButtonControlStyle}"
                VerticalAlignment="Center" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5">
              <Control.RenderTransform>
                <TransformGroup>
                  <ScaleTransform ScaleX="1" ScaleY="1"/>
                </TransformGroup>
              </Control.RenderTransform>
            </Control>
            <Ellipse Grid.Column="1" Grid.Row="0" x:Name="InnerCircle" HorizontalAlignment="Center" VerticalAlignment="Center"
                Width="5" Height="5" Fill="{ThemeResource ControlHandleColor}" Visibility="Hidden"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
              <Setter TargetName="InnerCircle" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- ******************************** Checkbox *********************************** -->

  <Style x:Key="DefaultCheckBoxStyle" TargetType="{x:Type CheckBox}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type CheckBox}">
          <Grid Margin="0,2,0,2">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid x:Name="GrowControl" HorizontalAlignment="Left" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
              <Grid.RenderTransform>
                <TransformGroup>
                  <ScaleTransform ScaleX="1" ScaleY="1"/>
                </TransformGroup>
              </Grid.RenderTransform>
              <Control Grid.Column="0" Grid.Row="0" Width="26" Height="26" Style="{ThemeResource ButtonControlStyle}"/>
              <Path x:Name="Check" Grid.Column="0" Grid.Row="0" Width="26" Height="26" Visibility="Hidden" Stretch="None"
                  Stroke="{ThemeResource ControlHandleColor}" StrokeThickness="2" Data="M8,13 L11,18 L18,6"/>
            </Grid>
            <ContentPresenter Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="10,0,10,0"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
              <Setter TargetName="Check" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- ***************************** Dialog close button ******************************** -->

  <!-- Style for a close button (used on dialog windows) -->
  <Style x:Key="DialogCloseButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <ControlTemplate.Resources>
            <Storyboard x:Key="FocusedStoryboard" FillBehavior="HoldEnd">
              <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ButtonBackground" Storyboard.TargetProperty="Background.GradientStops[1].Color">
                <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource DialogCloseButtonShape2Color}"/>
                <SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="{ThemeResource DialogCloseButtonShape2HighlightColor}"/>
              </ColorAnimationUsingKeyFrames>
              <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="CloseSign" Storyboard.TargetProperty="Stroke">
                <SplineColorKeyFrame KeyTime="00:00:00" Value="{ThemeResource DialogCloseButtonShape3Color}"/>
                <SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="{ThemeResource DialogCloseButtonCrossColor}"/>
              </ColorAnimationUsingKeyFrames>
            </Storyboard>
          </ControlTemplate.Resources>
          <Grid>
            <Border x:Name="ButtonBackground" BorderThickness="2" Width="34" Height="34" BorderLineJoin="Miter">
              <Border.BorderBrush>
                <RadialGradientBrush>
                  <GradientStop Color="{ThemeResource DialogCloseButtonBackgroundRadius1Color}" Offset="0.827"/>
                  <GradientStop Color="{ThemeResource DialogCloseButtonBackgroundRadius2Color}" Offset="0.909"/>
                  <GradientStop Color="{ThemeResource DialogCloseButtonBackgroundRadius3Color}" Offset="1"/>
                </RadialGradientBrush>
              </Border.BorderBrush>
              <Border.Background>
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                  <GradientStop Color="{ThemeResource DialogCloseButtonShape1Color}" Offset="0"/>
                  <GradientStop Color="{ThemeResource DialogCloseButtonShape2Color}" Offset="0.332"/>
                  <GradientStop Color="{ThemeResource DialogCloseButtonShape3Color}" Offset="0.798"/>
                  <GradientStop Color="{ThemeResource DialogCloseButtonShape4Color}" Offset="1"/>
                </LinearGradientBrush>
              </Border.Background>
              <Path x:Name="CloseSign" Stretch="Fill" Stroke="{ThemeResource DialogHeaderColor}" StrokeThickness="2" HorizontalAlignment="Left" VerticalAlignment="Top"
                Margin="6" Width="18" Height="18" Data="M0,20 L20,0 z M0,0 L20,20 z" RenderTransformOrigin="0.5,0.5"/>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Focused_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- **************************** Arrow buttons *************************************** -->

  <Style x:Key="ArrowButtonControlStyle" TargetType="{x:Type Control}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Control}">
          <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="Arrow" Fill="{ThemeResource ArrowButtonArrowColor}" Stretch="Fill"
                Margin="9,7,9,7" Data="M0,0 L0,39 39,19.5 z"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ArrowButtonLeftStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Control Style="{ThemeResource ArrowButtonControlStyle}"
              RenderTransformOrigin="0.5,0.5">
            <Control.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Control.RenderTransform>
            <Control.LayoutTransform>
              <RotateTransform Angle="180"/>
            </Control.LayoutTransform>
          </Control>
          <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"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Pressed_BeginStoryboard" Storyboard="{ThemeResource PressedButtonStoryboard}"
                    HandoffBehavior="TemporaryReplace"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryboard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ArrowButtonRightStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Control Style="{ThemeResource ArrowButtonControlStyle}"
              RenderTransformOrigin="0.5,0.5">
            <Control.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Control.RenderTransform>
            <Control.LayoutTransform>
              <RotateTransform Angle="0"/>
            </Control.LayoutTransform>
          </Control>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryboard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ArrowButtonUpStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Control Style="{ThemeResource ArrowButtonControlStyle}"
              RenderTransformOrigin="0.5,0.5">
            <Control.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Control.RenderTransform>
            <Control.LayoutTransform>
              <RotateTransform Angle="-90"/>
            </Control.LayoutTransform>
          </Control>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryboard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ArrowButtonDownStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Control Style="{ThemeResource ArrowButtonControlStyle}"
              RenderTransformOrigin="0.5,0.5">
            <Control.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Control.RenderTransform>
            <Control.LayoutTransform>
              <RotateTransform Angle="90"/>
            </Control.LayoutTransform>
          </Control>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedButtonStoryboard}"/>
                <SoundPlayerAction Source="navigate.wav" DisableOnAudioOutput="True"/>
              </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"/>
                <SoundPlayerAction Source="click.wav" DisableOnAudioOutput="True"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Pressed_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryboard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- *************************** Play control buttons ****************************** -->

  <Style x:Key="BaseWindowButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5" Margin="8">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Grid.RenderTransform>


            <!-- OSD Button Control -->
            <Canvas Name="ButtonControlRectangle" Height="174" Width="174">
              <Ellipse x:Name="ButtonBackground" Height="160" Width="160" Canvas.Left="7" Canvas.Top="7">
                <Ellipse.Fill>
                  <RadialGradientBrush Center="0.5,0.5" GradientOrigin="0.5,0.5">
                    <GradientStop Color="#00221E1F" Offset="0"/>
                    <GradientStop Color="#8C221E1F" Offset="1"/>
                  </RadialGradientBrush>
                </Ellipse.Fill>
              </Ellipse>
              <Ellipse Height="150" Width="150" Canvas.Left="12" Canvas.Top="12" StrokeThickness="16" StrokeLineJoin="Miter">
                <Ellipse.Stroke>
                  <RadialGradientBrush Center="0.3,0.3" GradientOrigin="0.5,0.5">
                    <GradientStop Color="#40FFFFFF" Offset="0"/>
                    <GradientStop Color="#CC303030" Offset="1"/>
                  </RadialGradientBrush>
                </Ellipse.Stroke>
              </Ellipse>

              <!-- Embedded symbol  -->
              <Control x:Name="ContentControl" Template="{DynamicResource ResourceKey=ContentControlTemplate}" />

              <Canvas.LayoutTransform>
                <TransformGroup>
                  <ScaleTransform ScaleX="0.4" ScaleY="0.4"/>
                </TransformGroup>
              </Canvas.LayoutTransform>
            </Canvas>
          </Grid>


          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedOSDButtonStoryboard}"/>
              </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>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryboard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="BasePlayerControlButtonStyle" BasedOn="{ThemeResource BaseWindowButtonStyle}"/>

  <Style x:Key="PlayButtonStyle" BasedOn="{ThemeResource BasePlayerControlButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource PlayControlTemplate}" />
    </Style.Resources>
  </Style>

  <Style x:Key="PauseButtonStyle" BasedOn="{ThemeResource BasePlayerControlButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource PauseControlTemplate}" />
    </Style.Resources>
  </Style>

  <Style x:Key="StopButtonStyle" BasedOn="{ThemeResource BasePlayerControlButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource StopControlTemplate}" />
    </Style.Resources>
  </Style>

  <Style x:Key="ForwardButtonStyle" BasedOn="{ThemeResource BasePlayerControlButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource ForwardControlTemplate}" />
    </Style.Resources>
  </Style>

  <Style x:Key="RewindButtonStyle" BasedOn="{ThemeResource BasePlayerControlButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource RewindControlTemplate}" />
    </Style.Resources>
  </Style>

  <Style x:Key="SkipForwardButtonStyle" BasedOn="{ThemeResource BasePlayerControlButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource SkipForwardControlTemplate}" />
    </Style.Resources>
  </Style>

  <Style x:Key="SkipBackButtonStyle" BasedOn="{ThemeResource BasePlayerControlButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource SkipBackControlTemplate}" />
    </Style.Resources>
  </Style>

  <!-- audio mute control style -->
  <Style x:Key="AudioActiveButtonStyle" BasedOn="{ThemeResource BasePlayerControlButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate">
        <ControlTemplate>
          <Grid>
            <Control x:Name="Audio" Template="{ThemeResource AudioActiveControlTemplate}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
            <Control x:Name="MuteOnOff" Template="{ThemeResource MuteOnOffControlTemplate}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                   IsVisible="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type mp_special_controls:PlayerControl}},Path=IsMuted}"/>
          </Grid>
        </ControlTemplate>
      </ResourceWrapper>
    </Style.Resources>
  </Style>
  
  <Style x:Key="AudioInactiveButtonStyle" BasedOn="{ThemeResource BasePlayerControlButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate">
        <ControlTemplate>
          <Grid>
             <Control x:Name="Audio" Template="{ThemeResource AudioInactiveControlTemplate}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
          </Grid>
        </ControlTemplate>
      </ResourceWrapper>
    </Style.Resources>
  </Style>

  <!-- global buttons -->

  <Style x:Key="PowerButtonStyle" BasedOn="{ThemeResource GlobalButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource PowerControlTemplate}" />
    </Style.Resources>
  </Style>

  <Style x:Key="WindowCloseButtonStyle" BasedOn="{ThemeResource GlobalButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource WindowCloseControlTemplate}" />
    </Style.Resources>
  </Style>

  <Style x:Key="WindowMinimizeButtonStyle" BasedOn="{ThemeResource GlobalButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource WindowMinimizeControlTemplate}" />
    </Style.Resources>
  </Style>

  <Style x:Key="SuspendButtonStyle" BasedOn="{ThemeResource GlobalButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource SuspendControlTemplate}" />
    </Style.Resources>
  </Style>

  <Style x:Key="NavigateBackButtonStyle" BasedOn="{ThemeResource GlobalButtonStyle}">
    <Style.Resources>
      <ResourceWrapper x:Key="ContentControlTemplate" Resource="{ThemeResource NavigateBackControlTemplate}" />
    </Style.Resources>
  </Style>

  <!-- ********************************* PlusMinus button ******************************** -->

  <Style x:Key="PlusMinusButtonStyle" TargetType="{x:Type CheckBox}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type CheckBox}">
          <Grid x:Name="GrowControl" Margin="0,2,0,2" RenderTransformOrigin="0.5,0.5">
            <Grid.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Grid.RenderTransform>
            <Control Style="{ThemeResource ButtonControlStyle}"/>
            <Path x:Name="PathHorz" Stretch="None" Stroke="{ThemeResource ControlHandleColor}"
                Height="25" Width="25" Data="M5,12 L19,12 z" StrokeThickness="2"/>
            <Path x:Name="PathVert" Stretch="None" Stroke="{ThemeResource ControlHandleColor}"
                Height="25" Width="25" Data="M12,5 L12,19 z" StrokeThickness="2"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
              <Setter TargetName="PathVert" Property="Visibility" Value="Hidden"/>
            </Trigger>
            <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>
            <Trigger Property="IsEnabled" Value="False">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Disabled_BeginStoryBoard" Storyboard="{ThemeResource DisabledButtonStoryboard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Disabled_BeginStoryBoard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- To be removed
  <!- ***************************** Zoom buttons ******************************** ->

  <Storyboard x:Key="FocusedZoomButtonStoryBoard" FillBehavior="Stop">
    <DoubleAnimation BeginTime="00:00:00" From="0" To="1" Duration="00:00:00.3000000" Storyboard.TargetName="Focused" Storyboard.TargetProperty="Opacity"/>
    <DoubleAnimation BeginTime="00:00:00" From="1" To="0" Duration="00:00:00.3000000" Storyboard.TargetName="Unfocused" Storyboard.TargetProperty="Opacity"/>
  </Storyboard>

  <Style x:Key="ZoomInButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5">
            <Grid.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Grid.RenderTransform>
            <Image x:Name="Focused" Source="zoom_in_enabled.png" Width="32" Height="32" Opacity="0"/>
            <Image x:Name="Unfocused" Source="zoom_in_disabled.png" Width="32" Height="32"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedZoomButtonStoryBoard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Focused_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ZoomOutButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5">
            <Grid.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Grid.RenderTransform>
            <Image x:Name="Focused" Source="zoom_in_enabled.png" Width="32" Height="32" Opacity="0"/>
            <Image x:Name="Unfocused" Source="zoom_out_disabled.png" Width="32" Height="32"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedZoomButtonStoryBoard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Focused_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!- ***************************** Rotate buttons ******************************** ->

  <Storyboard x:Key="FocusedRotateButtonStoryBoard" FillBehavior="Stop">
    <DoubleAnimation BeginTime="00:00:00" From="0" To="1" Duration="00:00:00.3000000" Storyboard.TargetName="Focused" Storyboard.TargetProperty="Opacity"/>
    <DoubleAnimation BeginTime="00:00:00" From="1" To="0" Duration="00:00:00.3000000" Storyboard.TargetName="Unfocused" Storyboard.TargetProperty="Opacity"/>
  </Storyboard>

  <Style x:Key="RotateLeftButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5">
            <Grid.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Grid.RenderTransform>
            <Image x:Name="Focused" Source="rotate_left_enabled.png" Width="32" Height="32" Opacity="0"/>
            <Image x:Name="Unfocused" Source="rotate_left_disabled.png" Width="32" Height="32"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedRotateButtonStoryBoard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Focused_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="RotateRightButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5">
            <Grid.RenderTransform>
              <TransformGroup>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
              </TransformGroup>
            </Grid.RenderTransform>
            <Image x:Name="Focused" Source="rotate_right_enabled.png" Width="32" Height="32" Opacity="0"/>
            <Image x:Name="Unfocused" Source="rotate_right_disabled.png" Width="32" Height="32"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="HasFocus" Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="Focused_BeginStoryboard" Storyboard="{ThemeResource FocusedRotateButtonStoryBoard}"/>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="Focused_BeginStoryboard"/>
              </Trigger.ExitActions>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
-->
</ResourceDictionary>
