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

    <Page.Resources>

        <Style x:Key="StTxt" TargetType="TextBlock">
            <Setter Property="FontSize" Value="15"/>
        </Style>

        <Style x:Key="StBtn" TargetType="Button">
            <Setter Property="FontSize" Value="15"/>
            <Setter Property="Background" Value="LightBlue"/>
            <Setter Property="Width" Value="80"/>
            <Setter Property="Height" Value="35"/>
        </Style>

        <DataTemplate x:Key="Book">
            <Border BorderBrush="Black" BorderThickness="1" Width="900">
                <StackPanel Orientation="Horizontal">
                    <Image  Source="{Binding Cover}" Margin="10 0 10 0" Height="250px" Width="200px"/>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Название: " Style="{StaticResource StTxt}">
                            <Run Text="{Binding Title}"/>
                        </TextBlock>
                        <TextBlock Text="Автор: " Style="{StaticResource StTxt}">
                            <Run Text="{Binding Author}"/>
                        </TextBlock>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Количество: " Style="{StaticResource StTxt}"/>
                            <TextBlock x:Name="inc" Text="{Binding InCost}" Style="{StaticResource StTxt}" />
                        </StackPanel>

                        <TextBlock Text="Цена: " Style="{StaticResource StTxt}"/>
                        <TextBlock Text="{Binding Cost}" TextDecorations="{Binding decor}" Style="{StaticResource StTxt}"/>
                        <TextBlock Text="{Binding NewPrice}" Style="{StaticResource StTxt}"/>


                    </StackPanel>
                    <Button Content="Удалить" Click="Button_Click_2" Uid="{Binding ID}"  Height="50" Width="150" Style="{StaticResource StBtn}" Margin="50"/>
                </StackPanel>
            </Border>
        </DataTemplate>
    </Page.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="567*"/>
            <ColumnDefinition Width="233*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="88"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Vertical" Grid.Column="1" VerticalAlignment="Center" Height="70">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <Button Content="Назад" Click="Button_Click"  Style="{StaticResource StBtn}"/>
                <Button Content="Очистить" Click="Button_Click_1"  Style="{StaticResource StBtn}"/>
            </StackPanel>
            <Button Name="Buy" Click="Buy_Click" Width="160" Style="{StaticResource StBtn}">Оформить заказ</Button>
        </StackPanel>
        <ListBox x:Name="CartList" ItemTemplate="{StaticResource Book}"  Grid.Row="1" Grid.ColumnSpan="2"/>
    </Grid>
</Page>