<Page x:Class="WpfApp1.MainPage"
      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:WpfApp1"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="MainPage" DataContext ="{Binding RelativeSource={RelativeSource Mode=Self}}">
    <Page.Resources>
        <DataTemplate x:Key="allBooks">
            <Border BorderBrush="Black" BorderThickness="1" Width="1700">
                <StackPanel Uid="{Binding IdBook}" Orientation="Horizontal">
                    <Image Height="100" Source="{Binding Image}"></Image>
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Название: "></TextBlock>
                            <TextBlock Text="{Binding Title}"/>
                            <TextBlock Text=" | Жанр: "/>
                            <TextBlock Text="{Binding tittleGenre}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Автор: "></TextBlock>
                            <TextBlock Text="{Binding nameAuthor}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Цена: "></TextBlock>
                            <TextBlock Text="{Binding Cost, StringFormat=0 }" />
                            <TextBlock Text=" руб."/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Количество в магазине: "></TextBlock>
                            <TextBlock Text="{Binding Store}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Количество на складе: "></TextBlock>
                            <TextBlock Text="{Binding Stock}"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding allDescription}" TextWrapping="Wrap" Width="1500" />
                        </StackPanel>
                    </StackPanel>
                    <Button x:Name="Add" Content="Добавить в корзину" Click="Add_Click" Uid="{Binding IdBook}" Height="50"></Button>
                </StackPanel>
            </Border>
        </DataTemplate>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="90"/>
            <RowDefinition Height="127*"/>
        </Grid.RowDefinitions>
        <ListBox x:Name="ListBoksAllBooks"  Grid.Row="1" ItemTemplate="{StaticResource allBooks}"></ListBox>
        <Border Grid.Row="0" HorizontalAlignment="Right" BorderBrush="Black" BorderThickness="1" Margin="0,0,50,0">
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Количество выбранных книг: "></TextBlock>
                    <TextBlock x:Name="kolbook"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Стоимость покупки: "></TextBlock>
                    <TextBlock x:Name="price" TextDecorations="{Binding OldPrise}"/>
                    <TextBlock Text=" "/>
                    <TextBlock x:Name="newprice" Visibility="Collapsed"/>
                    <TextBlock Text=" руб."/>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Размер скидки: "></TextBlock>
                    <TextBlock x:Name="sale"/>
                    <TextBlock Text="%"/>
                </StackPanel>
                <Button Content="Посмотреть содержание карзины" Name="Basket" Click="Basket_Click"></Button>
            </StackPanel>
        </Border>
    </Grid>
</Page>
