<Page x:Class="modulekz.ListBook"
      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:modulekz"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="ListBook">

    <Page.Resources>
        <DataTemplate x:Key="Book">
            <Border BorderBrush="Black" BorderThickness="1" MinWidth="600" MaxWidth="680" MaxHeight="680">
                <StackPanel Orientation="Horizontal">
                    <Image Source="{Binding Img}" Width="120"  Margin="0 0 10 0"/>
                    <StackPanel Orientation="Vertical" MaxWidth="450" MinWidth="450" >
                        <TextBlock Text="Название: ">
                            <Run Text="{Binding Title}"/>
                            <Run Text="  |  Жанр:"/>
                            <Run Text="{Binding Style}"/>
                        </TextBlock>
                        <TextBlock Text="Автор: ">
                            <Run Text="{Binding Author}"/>
                        </TextBlock>
                        <TextBlock Text="Цена: ">
                            <Run Text="{Binding Cost}"/>
                        </TextBlock>
                        <TextBlock Text="Количество в магазине: ">
                            <Run Text="{Binding CountStore}"/>
                        </TextBlock>
                        <TextBlock Text="Количество на складе: ">
                            <Run Text="{Binding CountStock}"/>
                        </TextBlock>
                        <TextBlock Text="Описание: " TextWrapping="Wrap" MaxWidth="450">
                            <Run Text="{Binding Description}" />
                        </TextBlock>
                    </StackPanel>
                    <Button x:Name="AddCart" Content="Заказать" Height="50" VerticalAlignment="Bottom" Margin="15 0 0 0 " Uid="{Binding Id}" Click="AddCart_Click" Width="75"/>
                </StackPanel>
            </Border>
        </DataTemplate>
    </Page.Resources>


    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="75"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Border BorderBrush="Black" BorderThickness="1"  HorizontalAlignment="Right">
            <StackPanel Orientation="Vertical" Margin="0 0 10 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 x:Name="Gocart" Content="Корзина" Click="Gocart_Click"/>
            </StackPanel>
        </Border>

        <ListBox x:Name="ListBooks" ItemTemplate="{StaticResource Book}" Grid.Row="1" />
    </Grid>
</Page>
