<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:fv="using:C1.Xaml.FlexViewer"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:uu="single line comment"
    mc:Ignorable="uu"
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="ms-appx:///C1.UWP.FlexViewer/Themes/Common.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!--<ResourceDictionary.ThemeDictionaries>
      
        <ResourceDictionary x:Key="Default">
          <SolidColorBrush x:Key="PageAreaBorderBrush" Color="#FFF2726A" />
        </ResourceDictionary>
        <ResourceDictionary x:Key="Light">
          <SolidColorBrush x:Key="PageAreaBorderBrush" Color="#FFF2726A" />
        </ResourceDictionary>
      
    </ResourceDictionary.ThemeDictionaries>-->

    <SolidColorBrush x:Key="SelectionGripperForegroundBrush" Color="#FFD24726" />
    <SolidColorBrush x:Key="SelectionGripperBackgroundBrush" Color="White" />

    <!--#region SelectionGripper Implicit Style-->

    <Style TargetType="fv:SelectionGripper">
        <Setter Property="Foreground" Value="{StaticResource SelectionGripperForegroundBrush}"/>
        <Setter Property="Background" Value="{StaticResource SelectionGripperBackgroundBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="fv:SelectionGripper">
                    <Grid>
                        <Ellipse Fill="{TemplateBinding Background}" Width="25" Height="25" />
                        <Ellipse Stroke="{TemplateBinding Foreground}" Width="19" Height="19" StrokeThickness="1.75" />
                        <Line Stroke="{TemplateBinding Foreground}" StrokeThickness="1.75" VerticalAlignment="Top" X1="12.5" X2="12.5" Y2="3" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--#endregion-->

    <!--#region PagesFlipViewItemStyle Style-->

    <Style x:Key="PagesFlipViewItemStyle" TargetType="FlipViewItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="FlipViewItem">
                    <ScrollViewer
                        IsTabStop="True"
                        HorizontalScrollBarVisibility="Auto"
                        VerticalScrollBarVisibility="Auto"
                        ZoomMode="Enabled"
                        >
                        <ContentPresenter
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            />
                    </ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--#endregion-->

    <!--#region C1FlexViewerPane Implicit Style-->

    <Style TargetType="fv:C1FlexViewerPane">
        <Setter Property="PageBorderBrush" Value="{StaticResource PageBorderBrush}"/>
        <Setter Property="PageAreaBackground" Value="{StaticResource PageAreaBackground}"/>
        <Setter Property="PageBackground" Value="{StaticResource PageBackground}"/>
        <Setter Property="ThumbnailPageNumBackground" Value="{StaticResource ThumbnailPageNumBackground}"/>
        <Setter Property="ThumbnailPageNumForeground" Value="{StaticResource ThumbnailPageNumForeground}"/>
        <Setter Property="ThumbnailSelectedBackground" Value="{StaticResource ThumbnailSelectedBackground}"/>
        <Setter Property="ThumbnailSelectedOverBackground" Value="{StaticResource ThumbnailSelectedOverBackground}"/>
        <Setter Property="ThumbnailOverBackground" Value="{StaticResource ThumbnailOverBackground}"/>
        <Setter Property="StatusBackground" Value="{StaticResource StatusBackground}"/>
        <Setter Property="StatusBorderBrush" Value="{StaticResource StatusBorderBrush}"/>
        <Setter Property="StatusForeground" Value="{StaticResource StatusForeground}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="fv:C1FlexViewerPane">

                    <Grid x:Name="layoutRoot" Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}">

                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <ScrollViewer
                            x:Name="contentViewer"
                            IsTabStop="True"
                            HorizontalScrollBarVisibility="Auto"
                            VerticalScrollBarVisibility="Auto"
                            ZoomMode="Enabled"
                            >
                            <Image x:Name="contentImage" />
                        </ScrollViewer>

                        <fv:PagesFlipView
                            x:Name="pagesFlipView"
                            IsTabStop="False"
                            Visibility="Collapsed" 
                            ItemContainerStyle="{StaticResource PagesFlipViewItemStyle}"
                            VirtualizingStackPanel.VirtualizationMode="Recycling"
                            >
                            <fv:PagesFlipView.ItemTemplate>
                                <DataTemplate>
                                    <fv:PagesPresenter>
                                        <Image
                                            Source="{Binding ImageSource}"
                                            Width="{Binding ImageWidth}"
                                            Height="{Binding ImageHeight}"
                                            />
                                    </fv:PagesPresenter>
                                </DataTemplate>
                            </fv:PagesFlipView.ItemTemplate>
                        </fv:PagesFlipView>

                        <Border
                            x:Name="statusBorder"
                            Grid.Row="1"
                            BorderThickness="0, 1, 0, 0"
                            Padding="7, 3, 7, 4"
                            uu:VerticalAlignment="Bottom"
                            uu:HorizontalAlignment="Stretch"
                            Visibility="Collapsed"
                            >
                            <TextBlock
                                x:Name="statusText"
                                HorizontalAlignment="Stretch"
                                TextWrapping="WrapWholeWords"
                                />
                        </Border>

                        <Popup x:Name="selectionStartPopup" HorizontalAlignment="Left" VerticalAlignment="Top">
                            <fv:SelectionGripper x:Name="selectionStartGripper" />
                        </Popup>
                        <Popup x:Name="selectionEndPopup" HorizontalAlignment="Left" VerticalAlignment="Top">
                            <fv:SelectionGripper x:Name="selectionEndGripper" />
                        </Popup>

                        <Popup x:Name="toolTipPopup">
                            <Border 
                                x:Name="toolTipRoot"
                                Background="{ThemeResource ToolTipBackgroundThemeBrush}"
                                BorderThickness="{ThemeResource ToolTipBorderThemeThickness}"
                                BorderBrush="{ThemeResource ToolTipBorderThemeBrush}"
                                Padding="10, 6, 10, 7"
                                >
                                <Border.Resources>
                                    <Storyboard x:Key="showToolTipStoryboard">
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="toolTipPopup" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimation Storyboard.TargetName="toolTipRoot" From="0" To="1" Storyboard.TargetProperty="Opacity" Duration="0:0:0.30" />
                                    </Storyboard>
                                    <Storyboard x:Key="hideToolTipStoryboard">
                                        <DoubleAnimation Storyboard.TargetName="toolTipRoot" From="1" To="0" Storyboard.TargetProperty="Opacity" Duration="0:0:0.30" />
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="toolTipPopup" Storyboard.TargetProperty="IsOpen">
                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.30" Value="False"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </Border.Resources>
                                <TextBlock 
                                    Text="{Binding ReportToolTip, RelativeSource={RelativeSource TemplatedParent}}"
                                    Foreground="{ThemeResource ToolTipForegroundThemeBrush}"
                                    FontSize="{ThemeResource ToolTipContentThemeFontSize}"
                                    FontFamily="{ThemeResource ContentControlThemeFontFamily}"
                                    />
                            </Border>
                        </Popup>

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

    <!--#endregion-->

</ResourceDictionary>
