<Page x:Class="Exam19Apr.pgBooksCatalog"
      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:Exam19Apr"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="pgBooksCatalog">
    <Page.Resources>
        <DataTemplate x:Key="outputBooks">
            <Border BorderBrush="Black" BorderThickness="1,1,1,1">
                <StackPanel Orientation="Horizontal" Width="600px">
                    <StackPanel>
                        <Image Source="{Binding Image}" Width="100px" Height="100px"></Image>
                    </StackPanel>
                    <StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Название: "></TextBlock>
                            <TextBlock Text="{Binding Heading}"></TextBlock>
                            <TextBlock Text=" | "></TextBlock>
                            <TextBlock Text="Жанр: "></TextBlock>
                            <TextBlock Text="{Binding Style}"></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Автор: "></TextBlock>
                            <TextBlock Text="{Binding Writer}"></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Цена: "></TextBlock>
                            <TextBlock Text="{Binding Price}"></TextBlock>
                            <TextBlock Text="руб."></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Количество в магазине: "></TextBlock>
                            <TextBlock Text="{Binding CheckStoreCount}"></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Количество в магазине: "></TextBlock>
                            <TextBlock Text="{Binding CheckStockCount}"></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Описание: "></TextBlock>
                            <TextBlock Text="{Binding Specification}" TextWrapping="Wrap" MaxWidth="400px"></TextBlock>
                        </StackPanel>
                        <Button Name="btnAddBok" Content="Добавить в корзину" Uid="{Binding id}" Click="btnAddBok_Click"></Button>
                    </StackPanel>
                </StackPanel>
            </Border>
        </DataTemplate>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="4*"/>
        </Grid.RowDefinitions>
        <Border BorderBrush="Black" BorderThickness="1,1,1,1">
            <StackPanel Grid.Row="0"  HorizontalAlignment="Right">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Количество выбранных книг: "></TextBlock>
                    <TextBlock Name="tbCount"></TextBlock>
                </StackPanel>
                <StackPanel Orientation="Horizontal" >
                    <TextBlock Text="Стоимость покупки: "></TextBlock>
                    <TextBlock Name="tbPrice"></TextBlock>
                    <TextBlock Text=" "></TextBlock>
                    <TextBlock Name="tbSalePrice"></TextBlock>
                    <TextBlock Text=" руб." Name="tbRub"></TextBlock>
                </StackPanel>
                <StackPanel Orientation="Horizontal" >
                    <TextBlock Text="Размер скидки: "></TextBlock>
                    <TextBlock Name="tbSale"></TextBlock>
                    <TextBlock Text=" %" Name="tbPer"></TextBlock>
                </StackPanel>
                <Button Name="btnGoCart" Content="Корзина" Click="btnGoCart_Click"></Button>
            </StackPanel>
        </Border>
        <ListBox Name="lbBooks" ItemTemplate="{StaticResource outputBooks}" Grid.Row="1"></ListBox>
    </Grid>
</Page>
