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

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="Посмотреть корзину" Height="30" Margin="0 0 20 0" Click="Button_Click_1"/>
            <Border BorderBrush="Black" Padding="7" BorderThickness="1" Width="300" HorizontalAlignment="Right">
                <StackPanel Grid.Row="0">
                    <TextBlock>
                <Run Text="Количество выбранных книг: "/>
                <Run Name="selectedCount"/>
                    </TextBlock>
                    <TextBlock>
                <Run Text="Cтоимость покупки: "/>
                <Run Name="buySum"/>
                    </TextBlock>
                    <TextBlock>
                <Run Text="Размер скидки: "/>
                <Run Name="discount" Text="5%"/>
                    </TextBlock>
                </StackPanel>
            </Border>
        </StackPanel>
        <ListView Grid.Row="1" Name="list">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Image Width="128" Source="{Binding Image}"/>
                        <StackPanel Margin="30 0 0 0" Orientation="Vertical">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock>
                                    <Run Text="Название: "/>
                                    <Run Text="{Binding title}"/>
                                </TextBlock>
                                <TextBlock Text=" | "/>
                                <TextBlock>
                                    <Run Text="Жанр: "/>
                                    <Run Text="{Binding genre}"/>
                                </TextBlock>
                            </StackPanel>
                            <TextBlock>
                                    <Run Text="Автор: "/>
                                    <Run Text="{Binding author}"/>
                            </TextBlock>
                            <TextBlock>
                                    <Run Text="Цена: "/>
                                    <Run Text="{Binding price}"/>
                            </TextBlock>
                            <TextBlock>
                                    <Run Text="Количество в магазине: "/>
                                    <Run Text="{Binding StoreCount, Mode=OneWay}"/>
                            </TextBlock>
                            <TextBlock>
                                    <Run Text="Количество на складе: "/>
                                    <Run Text="{Binding StockCount, Mode=OneWay}"/>
                            </TextBlock>
                            <TextBlock Width="400" TextWrapping="Wrap">
                                    <Run Text="Описание: "/>
                                    <Run Text="{Binding description}"/>
                            </TextBlock>
                        </StackPanel>
                        <Button Click="Button_Click" Height="50" Content="Добавить в корзину"/>
                    </StackPanel>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </Grid>
</Page>
