<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Telerik.UI.Xaml.Controls.Primitives"
    xmlns:localHubTile="using:Telerik.UI.Xaml.Controls.Primitives.HubTile">

    <Style x:Key="BaseHubTileStyle" TargetType="local:HubTileBase">
        <Setter Property="Background" Value="{StaticResource TelerikHubTileBackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TelerikHubTileBorderBrush}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="{StaticResource TelerikForegroundBrush}"/>
        <Setter Property="Width" Value="171"/>
        <Setter Property="Height" Value="171"/>
        <Setter Property="Margin" Value="5"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="Padding" Value="16,16,16,6"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
    </Style>

    <Style TargetType="local:RadCustomHubTile" BasedOn="{StaticResource BaseHubTileStyle}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadCustomHubTile">
                    <Grid x:Name="PART_LayoutRoot">
                        <localHubTile:FlipControl BackContent="{TemplateBinding BackContent}" 
                                                  BackContentTemplate="{TemplateBinding BackContentTemplate}" 
                                                  x:Name="PART_FlipControl"
                                                  BorderBrush="{TemplateBinding BorderBrush}"
                                                  Background="{TemplateBinding Background}"
                                                  BorderThickness="{TemplateBinding BorderThickness}"
                                                  IsFlipped="{Binding IsFlipped, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
                            <localHubTile:FlipControl.FrontContent>
                                <Grid>
                                    <ContentPresenter Content="{TemplateBinding FrontContent}" ContentTemplate="{TemplateBinding FrontContentTemplate}" 
                                                      HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                                    <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Bottom"
                                                      Content="{TemplateBinding Title}" ContentTemplate="{TemplateBinding TitleTemplate}"
                                                      Margin="{TemplateBinding Padding}"/>
                                </Grid>
                            </localHubTile:FlipControl.FrontContent>
                        </localHubTile:FlipControl>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:RadHubTile" BasedOn="{StaticResource BaseHubTileStyle}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadHubTile">
                    <Grid x:Name="PART_LayoutRoot">
                        <localHubTile:FlipControl BackContent="{TemplateBinding BackContent}" 
                                                  BackContentTemplate="{TemplateBinding BackContentTemplate}" 
                                                  x:Name="PART_FlipControl"
                                                  BorderBrush="{TemplateBinding BorderBrush}"
                                                  Background="{TemplateBinding Background}"
                                                      BorderThickness="{TemplateBinding BorderThickness}"
                                                  IsFlipped="{Binding IsFlipped, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
                            <localHubTile:FlipControl.FrontContent>
                                <Grid>
                                    <ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Top" Margin="{TemplateBinding Padding}"
                                                      Content="{TemplateBinding Message}" ContentTemplate="{TemplateBinding MessageTemplate}"/>

                                    <Image Source="{TemplateBinding ImageSource}" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center"/>

                                    <ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="{TemplateBinding Padding}"
                                                      Content="{TemplateBinding Title}" ContentTemplate="{TemplateBinding TitleTemplate}"/>
                                    <ContentControl x:Name="PART_Notification" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="{TemplateBinding Padding}"
                                                    FontWeight="Bold" Content="{TemplateBinding Notification}" ContentTemplate="{TemplateBinding NotificationTemplate}"/>
                                </Grid>
                            </localHubTile:FlipControl.FrontContent>
                        </localHubTile:FlipControl>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="localHubTile:CustomMosaicTilePart">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localHubTile:CustomMosaicTilePart">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition From="Front" To="Back">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection"
                                                             Duration="0:0:0.4" From="0" To="90"/>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection"
                                                             Duration="0:0:0.4" BeginTime="0:0:0.4" From="-90" To="0"/>
                                        </Storyboard>
                                    </VisualTransition>

                                    <VisualTransition From="Back" To="Front">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection"
                                                             Duration="0:0:0.4" BeginTime="0:0:0.4" From="-90" To="0"/>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection"
                                                             Duration="0:0:0.4" From="0" To="90" FillBehavior="HoldEnd"/>
                                        </Storyboard>
                                    </VisualTransition>
                                </VisualStateGroup.Transitions>

                                <VisualState x:Name="Front">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="-90"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="Back">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="90"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <ContentPresenter x:Name="BackPresenter">
                            <ContentPresenter.Content>
                                <Canvas x:Name="PART_BackCanvas">
                                    <Image Stretch="UniformToFill" Source="{TemplateBinding BackContent}"/>
                                </Canvas>
                            </ContentPresenter.Content>
                            <ContentPresenter.Projection>
                                <PlaneProjection x:Name="BackProjection" RotationX="-90"/>
                            </ContentPresenter.Projection>
                        </ContentPresenter>

                        <ContentPresenter x:Name="FrontPresenter">
                            <ContentPresenter.Content>
                                <Canvas x:Name="PART_FrontCanvas">
                                    <Image Stretch="UniformToFill" Source="{TemplateBinding FrontContent}"/>
                                </Canvas>
                            </ContentPresenter.Content>
                            <ContentPresenter.Projection>
                                <PlaneProjection x:Name="FrontProjection"/>
                            </ContentPresenter.Projection>
                        </ContentPresenter>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:RadMosaicHubTile" BasedOn="{StaticResource BaseHubTileStyle}">
        <Setter Property="UpdateInterval" Value="0:0:1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadMosaicHubTile">
                    <Grid x:Name="PART_LayoutRoot">
                        <localHubTile:FlipControl BackContent="{TemplateBinding BackContent}" 
                                                  BackContentTemplate="{TemplateBinding BackContentTemplate}" 
                                                  x:Name="PART_FlipControl"
                                                  BorderBrush="{TemplateBinding BorderBrush}"
                                                  Background="{TemplateBinding Background}"
                                                      BorderThickness="{TemplateBinding BorderThickness}"
                                                  IsFlipped="{Binding IsFlipped, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
                            <localHubTile:FlipControl.FrontContent>
                                <Grid>
                                    <Grid x:Name="PART_MosaicTileContainer">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>

                                        <localHubTile:CustomMosaicTilePart Style="{TemplateBinding TileStyle}"/>
                                        <localHubTile:CustomMosaicTilePart Style="{TemplateBinding TileStyle}" Grid.Column="1"/>
                                        <localHubTile:CustomMosaicTilePart Style="{TemplateBinding TileStyle}" Grid.Column="2"/>

                                        <localHubTile:CustomMosaicTilePart Style="{TemplateBinding TileStyle}" Grid.Row="1"/>
                                        <localHubTile:CustomMosaicTilePart Style="{TemplateBinding TileStyle}" Grid.Row="1" Grid.Column="1"/>
                                        <localHubTile:CustomMosaicTilePart Style="{TemplateBinding TileStyle}" Grid.Row="1" Grid.Column="2"/>

                                        <localHubTile:CustomMosaicTilePart Style="{TemplateBinding TileStyle}" Grid.Row="2"/>
                                        <localHubTile:CustomMosaicTilePart Style="{TemplateBinding TileStyle}" Grid.Row="2" Grid.Column="1"/>
                                        <localHubTile:CustomMosaicTilePart Style="{TemplateBinding TileStyle}" Grid.Row="2" Grid.Column="2"/>
                                    </Grid>

                                    <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="{TemplateBinding Padding}"
                                                      Content="{TemplateBinding Title}" ContentTemplate="{TemplateBinding TitleTemplate}"/>
                                </Grid>
                            </localHubTile:FlipControl.FrontContent>
                        </localHubTile:FlipControl>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="localHubTile:MosaicTilePart" x:Key="DefaultMosaicTileStyle">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localHubTile:MosaicTilePart">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition From="Front" To="Back">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection"
                                                             Duration="0:0:0.4" From="0" To="90" FillBehavior="HoldEnd"/>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection"
                                                             Duration="0:0:0.4" BeginTime="0:0:0.4" From="-90" To="0" FillBehavior="HoldEnd"/>
                                        </Storyboard>
                                    </VisualTransition>

                                    <VisualTransition From="Back" To="Front">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection"
                                                             Duration="0:0:0.4" BeginTime="0:0:0.4" From="-90" To="0"/>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection"
                                                             Duration="0:0:0.4" From="0" To="90" FillBehavior="HoldEnd"/>
                                        </Storyboard>
                                    </VisualTransition>
                                </VisualStateGroup.Transitions>

                                <VisualState x:Name="Front">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="-90"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="Back">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="90"/>
                                        </DoubleAnimationUsingKeyFrames>

                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <ContentPresenter x:Name="BackPresenter" Content="{TemplateBinding BackContent}" ContentTemplate="{TemplateBinding BackContentTemplate}">
                            <ContentPresenter.Projection>
                                <PlaneProjection x:Name="BackProjection" RotationX="-90"/>
                            </ContentPresenter.Projection>
                        </ContentPresenter>

                        <ContentPresenter x:Name="FrontPresenter" Content="{TemplateBinding FrontContent}" ContentTemplate="{TemplateBinding BackContentTemplate}">
                            <ContentPresenter.Projection>
                                <PlaneProjection x:Name="FrontProjection"/>
                            </ContentPresenter.Projection>
                        </ContentPresenter>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="localHubTile:MosaicTilePart" BasedOn="{StaticResource DefaultMosaicTileStyle}"/>

    <Style TargetType="local:RadPictureRotatorHubTile" BasedOn="{StaticResource BaseHubTileStyle}">
        <Setter Property="Width" Value="352"/>
        <Setter Property="UpdateInterval" Value="0:0:10"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadPictureRotatorHubTile">
                    <Grid>
                        <localHubTile:FlipControl BackContent="{TemplateBinding BackContent}" 
                                                  BackContentTemplate="{TemplateBinding BackContentTemplate}" 
                                                  x:Name="PART_FlipControl"
                                                  BorderBrush="{TemplateBinding BorderBrush}"
                                                  Background="{TemplateBinding Background}"
                                                      BorderThickness="{TemplateBinding BorderThickness}"
                                                  IsFlipped="{Binding IsFlipped, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
                            <localHubTile:FlipControl.FrontContent>
                                <Grid>
                                    <Canvas x:Name="PART_LayoutRoot">
                                        <StackPanel x:Name="PART_Panel">
                                            <Canvas Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
                                                <Grid Width="{TemplateBinding Width}" x:Name="PART_FirstContent">
                                                    <Image x:Name="PART_FirstImage" Stretch="UniformToFill" VerticalAlignment="Center"/>
                                                </Grid>
                                            </Canvas>

                                            <Canvas Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
                                                <Grid Width="{TemplateBinding Width}">
                                                    <Image x:Name="PART_SecondImage" Stretch="UniformToFill" VerticalAlignment="Center"/>
                                                </Grid>
                                            </Canvas>
                                        </StackPanel>
                                    </Canvas>

                                    <ContentPresenter Content="{TemplateBinding Title}" ContentTemplate="{TemplateBinding TitleTemplate}"
                                                      VerticalAlignment="Bottom" HorizontalAlignment="Stretch"  Margin="{TemplateBinding Padding}"/>
                                </Grid>
                            </localHubTile:FlipControl.FrontContent>
                        </localHubTile:FlipControl>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <localHubTile:DoubleScaleConverter x:Key="PositiveHalfConverter" Scale="0.5"/>
    <localHubTile:DoubleScaleConverter x:Key="NegativeConverter" Scale="-1"/>
    <localHubTile:DoubleScaleConverter x:Key="NegativeHalfConverter" Scale="-0.5"/>

    <Style TargetType="local:RadSlideHubTile" BasedOn="{StaticResource BaseHubTileStyle}">
        <Setter Property="UpdateInterval" Value="0:0:5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RadSlideHubTile">
                    <Grid x:Name="PART_LayoutRoot">
                        <localHubTile:FlipControl BackContent="{TemplateBinding BackContent}" 
                                                  BackContentTemplate="{TemplateBinding BackContentTemplate}" 
                                                  Background="{TemplateBinding Background}"
                                                  BorderBrush="{TemplateBinding BorderBrush}"
                                                  x:Name="PART_FlipControl"
                                                      BorderThickness="{TemplateBinding BorderThickness}"
                                                  IsFlipped="{Binding IsFlipped, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
                            <localHubTile:FlipControl.FrontContent>
                                <Grid>
                                    <localHubTile:SlideControl ExpandedState="{Binding ExpandedState, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" x:Name="PART_SlideControl"
                                                               Height="{TemplateBinding Height}"
                                                               TopContent="{TemplateBinding TopContent}" TopContentTemplate="{TemplateBinding TopContentTemplate}"
                                                               BottomContent="{TemplateBinding BottomContent}" BottomContentTemplate="{TemplateBinding BottomContentTemplate}"/>
                                    <ContentPresenter Content="{TemplateBinding Title}" ContentTemplate="{TemplateBinding TitleTemplate}"
                                                      VerticalAlignment="Bottom" HorizontalAlignment="Stretch"  Margin="{TemplateBinding Padding}"/>
                                </Grid>
                            </localHubTile:FlipControl.FrontContent>
                        </localHubTile:FlipControl>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="localHubTile:SlideControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localHubTile:SlideControl">
                    <Grid x:Name="LayoutRoot">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup>
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.7"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="SemiExpanded">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopContentTransform" Storyboard.TargetProperty="(TranslateTransform.Y)">
                                            <DiscreteDoubleKeyFrame Value="{Binding Path=Height, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource NegativeHalfConverter}}" KeyTime="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BottomContentTransform" Storyboard.TargetProperty="(TranslateTransform.Y)">
                                            <DiscreteDoubleKeyFrame Value="{Binding Path=Height, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource PositiveHalfConverter}}" KeyTime="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TopContentTransform" Storyboard.TargetProperty="(TranslateTransform.Y)">
                                            <DiscreteDoubleKeyFrame Value="0" KeyTime="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BottomContentTransform" Storyboard.TargetProperty="(TranslateTransform.Y)">
                                            <DiscreteDoubleKeyFrame Value="{Binding Height, RelativeSource={RelativeSource TemplatedParent}}" KeyTime="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter Content="{TemplateBinding TopContent}" ContentTemplate="{TemplateBinding TopContentTemplate}" 
                                          HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <ContentPresenter.RenderTransform>
                                <TranslateTransform x:Name="TopContentTransform" Y="{Binding Height, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource NegativeConverter}}"/>
                            </ContentPresenter.RenderTransform>
                        </ContentPresenter>
                        <ContentPresenter Content="{TemplateBinding BottomContent}" ContentTemplate="{TemplateBinding BottomContentTemplate}" 
                                          HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <ContentPresenter.RenderTransform>
                                <TranslateTransform x:Name="BottomContentTransform"/>
                            </ContentPresenter.RenderTransform>
                        </ContentPresenter>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="localHubTile:FlipControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localHubTile:FlipControl">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup>
                                <VisualStateGroup.Transitions>
                                    <VisualTransition From="NotFlipped" To="Flipped">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection" Duration="0:0:0.4" From="0" To="90"/>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection" Duration="0:0:0.4" BeginTime="0:0:0.4" From="-90" To="0"/>
                                            <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackContentPanel" Duration="0:0:0" From="0" To="1"/>
                                        </Storyboard>
                                    </VisualTransition>

                                    <VisualTransition From="Flipped" To="NotFlipped">
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection" Duration="0:0:0.4" BeginTime="0:0:0.4" From="-90" To="0"/>
                                            <DoubleAnimation Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection" Duration="0:0:0.4" From="0" To="90"/>
                                            <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackContentPanel" Duration="0:0:0" From="1" To="0" BeginTime="0:0:0.4"/>
                                        </Storyboard>
                                    </VisualTransition>
                                </VisualStateGroup.Transitions>

                                <VisualState x:Name="NotFlipped">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="-90"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackContentPanel">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="Flipped">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="FrontProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="90"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="RotationX" Storyboard.TargetName="BackProjection">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="BackContentPanel">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid Background="{TemplateBinding Background}">
                            <ContentPresenter Content="{TemplateBinding FrontContent}" ContentTemplate="{TemplateBinding FrontContentTemplate}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
                            <Grid.Projection>
                                <PlaneProjection x:Name="FrontProjection"/>
                            </Grid.Projection>
                        </Grid>

                        <Grid Background="{TemplateBinding Background}" x:Name="BackContentPanel">
                            <ContentPresenter Content="{TemplateBinding BackContent}" ContentTemplate="{TemplateBinding BackContentTemplate}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
                            <Grid.Projection>
                                <PlaneProjection x:Name="BackProjection"/>
                            </Grid.Projection>
                        </Grid>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
