<Page x:Class="VorobiovExam01.BookListPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:VorobiovExam01"
      mc:Ignorable="d" 
      d:DesignHeight="750" d:DesignWidth="1200" MinWidth="1200"
      Title="BookListPage">


    <Page.Resources>

        <Style x:Key="StTxt" TargetType="TextBlock">
            <Setter Property="FontSize" Value="15"/>
        </Style>

        <Style x:Key="StBtn" TargetType="Button">
            <Setter Property="FontSize" Value="15"/>
            <Setter Property="Background" Value="LightBlue"/>
        </Style>

        <DataTemplate x:Key="BookLs">
            <Border BorderBrush="Black" BorderThickness="1px">
                <StackPanel Orientation="Horizontal" Width="1200">
                    <Image x:Name="CoverBook" Source="{Binding Cover}"  Height="250px" Width="200px"></Image>
                    <StackPanel Orientation="Vertical">

                        <TextBlock Text="Название: " Margin="0,10,0,0" Style="{StaticResource StTxt}" >
                            <Run Text="{Binding Title}"/>
                            <Run Text=" | "/>
                            <Run Text="Жанр: "/>
                            <Run Text="{Binding Genre}"/>
                        </TextBlock>

                        <TextBlock Text="Автор: " Margin="0,10,0,0" Style="{StaticResource StTxt}"><Run Text="{Binding Author}"/>
                        </TextBlock>

                        <TextBlock Text="Цена: " Margin="0,10,0,0" Style="{StaticResource StTxt}"><Run Text="{Binding Cost}"/>
                            <Run Text=" руб."/>
                        </TextBlock>

                        <TextBlock Text="Количество в магазине: " Margin="0,10,0,0" Style="{StaticResource StTxt}"><Run Text="{Binding CIStore}"/>
                        </TextBlock>

                        <TextBlock Text="Количество на складе: " Margin="0,10,0,0" Style="{StaticResource StTxt}"><Run Text="{Binding CIStock}"/>
                        </TextBlock>
                        <TextBlock Text="Описание: " Width="650" TextWrapping="Wrap" Margin="0,10,0,10" Style="{StaticResource StTxt}"><Run Text="{Binding Description}"/>
                        </TextBlock>
                    </StackPanel>
                    <Button Height="50" Width="150" Style="{StaticResource StBtn}" Uid="{Binding ID}" Click="BtnClick_AddToCart">Добавить в корзину</Button>
                </StackPanel>
            </Border>
        </DataTemplate>
    </Page.Resources>


    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="163*"/>
            <ColumnDefinition Width="77*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="61*"/>
            <RowDefinition Height="189*"/>
        </Grid.RowDefinitions>

        <Border BorderBrush="Black" BorderThickness="1"  HorizontalAlignment="Right" Grid.Column="1" Margin="0,0,0,3" Width="230" >
            <StackPanel Orientation="Vertical" Margin="0,0,-1,0">
                <TextBlock Text="Количество выбранных книг: " >
                    <Run Name="RKol_v" Text=""/>
                </TextBlock>
                <TextBlock Text="Стоимость покупки:  " >
                    <Run Name="FirstCost" Text=""/>
                    <Run Text="  "/>
                    <Run Name="SecCost" Text=""/>
                </TextBlock>
                <TextBlock  Text="Размер скидки: ">
                    <Run Name="Rsale" Text="0"/>
                    <Run  Text="%"/>
                </TextBlock>
                <Button Content="Корзина" Click="BtnClick_Cart"  Style="{StaticResource StBtn}" Margin="10"/>
            </StackPanel>
        </Border>
        <ListBox x:Name="BookList" ItemTemplate="{StaticResource BookLs}"  Grid.Row="1" Grid.ColumnSpan="2" Margin="0,10,0,0"/>
    </Grid>
</Page>