<Window x:Class="TestDemo.WinCart"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:TestDemo"
        mc:Ignorable="d"
        Title="Корзина" Height="670" Width="1000"
        DataContext="{Binding RelativeSource= {RelativeSource Mode=Self}}"
        Background="Bisque">
    <Window.Resources>
        <DataTemplate x:Key="ListView">
            <Border BorderBrush="Black" BorderThickness="1" Width="1000">
                <StackPanel Orientation="Horizontal">
                    <Image Source="{Binding cover}" Width="150" Height="150"></Image>
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Название: "></TextBlock>
                            <TextBlock Text="{Binding title_book}"></TextBlock>
                            <TextBlock Text=" | "></TextBlock>
                            <TextBlock Text="Жанр: "></TextBlock>
                            <TextBlock Text="{Binding genres.title_genre}"></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Автор: "></TextBlock>
                            <TextBlock Text="{Binding authors.name_author}"></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Цена: " Visibility="{Binding VisibleMainPrice}"></TextBlock>
                            <TextBlock Text="{Binding price, StringFormat=0.00}" Visibility="{Binding VisibleMainPrice}"></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">

                            <TextBlock Text="Количество: "></TextBlock>
                            <Button x:Name="BtnPlus" Content="+" Click="BtnPlus_Click" Uid="{Binding id_book}"></Button>
                            <TextBlock Text="{Binding CountInCart}"  ></TextBlock>
                            <Button x:Name="BtnMinus" Content="-" Click="BtnMinus_Click" Uid="{Binding id_book}"></Button>

                            <Button x:Name="BtnDelete" Content="Удалить из корзины" Click="BtnDelete_Click" Uid="{Binding id_book}"></Button>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Цена: "></TextBlock>
                            <TextBlock Text="{Binding OldPrice , StringFormat=0.00}" TextDecorations="{Binding TextDecor}" ></TextBlock>
                            <TextBlock Text=" "></TextBlock>
                            <TextBlock Text="{Binding NewPrice, StringFormat=0.00}" Visibility="{Binding VisibleNewPrice}"  ></TextBlock>
                        </StackPanel>
                    </StackPanel>
                 
                </StackPanel>

            </Border>
        </DataTemplate>
    </Window.Resources>
    <Grid x:Name="MainGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="473*"/>
            <RowDefinition Height="166*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="1" Height="100">
            <Button x:Name="BtnClearAllList" Click="BtnClearAllList_Click"  Content="Очистить корзину" ></Button>
            <Button x:Name="BtnZakazat" Click="BtnZakazat_Click"  Content="Оформить заказ" ></Button>
            <Button x:Name="BtnGoBack" Click="BtnGoBack_Click"  Content="Выйти и очистить корзину" ></Button>
        </StackPanel>
        <ListView x:Name="ListCart" ItemTemplate="{StaticResource ListView}" Grid.Row="0" Visibility="Visible" Background="Bisque"></ListView>
        <StackPanel Grid.Row="0" Orientation="Vertical" x:Name="StackInfo" Visibility="Collapsed" HorizontalAlignment="Center" VerticalAlignment="Center">
            
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Номер заказа: "></TextBlock>
                <TextBlock x:Name="TxtNumber"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Заказ можно забрать: "></TextBlock>
                <TextBlock x:Name="TxtDateZakaza"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Заказ зарезервирован до  "></TextBlock>
                <TextBlock x:Name="TxtDateReserv"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Итоговое количество книг: "></TextBlock>
                <TextBlock x:Name="TxtCount"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Итоговая сумма заказа со скидкой: "></TextBlock>
                <TextBlock x:Name="TxtTotalPrice"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Итоговая сумма заказа без скидки: "></TextBlock>
                <TextBlock x:Name="TxtTotalPriceNonSale"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Скидка: "></TextBlock>
                <TextBlock x:Name="TxtSale"></TextBlock>
                <TextBlock Text=" %"></TextBlock>
            </StackPanel>

        </StackPanel>
    </Grid>

</Window>
