<Page
    x:Class="ExtendedSamples.C1BookDemo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ExtendedSamples"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:c1x="using:C1.Xaml.Extended"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <c1x:C1Book x:Name="book" BorderBrush="DarkGray">
            <c1x:C1Book.LeftPageTemplate>
                <ControlTemplate TargetType="ContentControl">
                    <Border Background="WhiteSmoke" BorderBrush="WhiteSmoke" BorderThickness="10 10 0 10">
                        <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}" />
                    </Border>
                </ControlTemplate>
            </c1x:C1Book.LeftPageTemplate>
            <c1x:C1Book.RightPageTemplate>
                <ControlTemplate TargetType="ContentControl">
                    <Border Background="WhiteSmoke" BorderBrush="WhiteSmoke" BorderThickness="10 10 0 10">
                        <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}" />
                    </Border>
                </ControlTemplate>
            </c1x:C1Book.RightPageTemplate>
            <c1x:C1Book.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.Background>
                            <LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
                                <GradientStop Color="#FFE2E8EB" Offset="0.2"/>
                                <GradientStop Color="#FFEEF4F7" Offset="0.3"/>
                                <GradientStop Color="#FFE2E8EB" Offset="0.4"/>
                            </LinearGradientBrush>
                        </Grid.Background>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Image Source="{Binding Path=CoverUri}" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1"/>
                        <TextBlock Text="{Binding Path=Title}" TextWrapping="Wrap" TextAlignment="Left" FontSize="11" FontWeight="Bold" Margin="10,7,10,10" Foreground="#FF22445F"/>
                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="2" Grid.RowSpan="1" Margin="10,7,10,10">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Text="{Binding Path=Price}" TextWrapping="NoWrap" Grid.ColumnSpan="1" Grid.Row="1" Grid.Column="1" FontSize="11" Foreground="#FF086C8E" FontWeight="Bold"/>
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Text="{Binding Path=Id}" Grid.ColumnSpan="1" Grid.Column="1" TextWrapping="NoWrap" FontSize="11" Foreground="#FF383838"/>
                            <TextBlock Text="{Binding BookCode_Text,Source={StaticResource ExtendedSamplesLocalization}}" TextWrapping="NoWrap" FontSize="11" Foreground="#FF383838"/>
                            <TextBlock Text="{Binding Price_Text,Source={StaticResource ExtendedSamplesLocalization}}" TextWrapping="NoWrap" Grid.Row="1" Margin="0,4,0,2" FontSize="11" Foreground="#FF383838"/>
                        </Grid>
                    </Grid>
                </DataTemplate>
            </c1x:C1Book.ItemTemplate>
        </c1x:C1Book>
        <Path x:Name="ArrowPath" Grid.Column="1" Fill="DarkGray" VerticalAlignment="Center" Data="M 10 0 L 10 20 0 10 0 15 12.5 27.5 25 15 25 10 15 20 15 0 z" RenderTransformOrigin="0.5,0.5" Margin="5">
            <Path.RenderTransform>
                <CompositeTransform Rotation="90"/>
            </Path.RenderTransform>
        </Path>
        <TextBlock Text="{Binding Note_Text,Source={StaticResource ExtendedSamplesLocalization}}" x:Name="Note" Grid.Column="2" VerticalAlignment="Center" FontSize="16" TextWrapping="Wrap" Width="50"/>

        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's window size -->
            <VisualStateGroup>
                <VisualState x:Name="WideLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="540" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                    </VisualState.Setters>
                </VisualState>

                <VisualState x:Name="NarrowLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="0" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="Note.Visibility" Value="Collapsed" />
                        <Setter Target="ArrowPath.Visibility" Value="Collapsed" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>
