<Window x:Class="wpf_connection3.MainWindow"
        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:wpf_connection3"
        mc:Ignorable="d"
        Background="PeachPuff"
        Title="MainWindow" Height="450" Width="800">

    <Grid ShowGridLines="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition />
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>


        <ListBox 
            Name="ProductListBox"
SelectionMode="Multiple"
SelectionChanged="ProductListBox_OnSelectionChanged"
Grid.Row="1"
Grid.Column="1"
Background="White"
     MouseDoubleClick="ProductListBox_MouseDoubleClick"
ItemsSource="{Binding productList}" 
            ScrollViewer.HorizontalScrollBarVisibility="Disabled" Margin="3,3,0,0"  RenderTransformOrigin="0.5,0.5">


            <ListBox.ItemContainerStyle>
                <Style 
            TargetType="ListBoxItem">
                    <Setter 
                Property="HorizontalContentAlignment"
                Value="Stretch" />
                </Style>
            </ListBox.ItemContainerStyle>

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border 
        BorderThickness="1" 
        BorderBrush="Black" 
        Background="{Binding BackgroundColor}"
                        CornerRadius="5">

                        <Grid 
Margin="10" 
HorizontalAlignment="Stretch">

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="64"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>

                            <Image
                            Width="64" 
                            Height="64"
                            Source="{Binding ImageBitmap}" HorizontalAlignment="Center"/>

                            <StackPanel
                            Grid.Column="1"
                            Margin="5"
                            Orientation="Vertical">

                                <TextBlock
                                Text="{Binding Title}"/>
                                <TextBlock
                                Text="{Binding ArticleNumber}"/>
                            </StackPanel>

                            <TextBlock
                            Grid.Column="2"
                        Text="{Binding ProductTypeID}"/>

                        </Grid>

                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>

        </ListBox>

        <WrapPanel
    Grid.Column="1" 
    Orientation="Horizontal" 
             Background="MediumPurple"
    ItemHeight="50">
            



            <ComboBox
    Width="164"
                 
    x:Name="ProductTypeFilter"
    SelectedIndex="0"
    SelectionChanged="ProductTypeFilter_SelectionChanged"
    ItemsSource="{Binding productTypeList}" Margin="0,15,0,15"/>

            <ComboBox
        Name="SortTypeComboBox"
        SelectedIndex="0"
        VerticalContentAlignment="Center"
        MinWidth="200"
        SelectionChanged="SortTypeComboBox_SelectionChanged"
                Height="20"
        ItemsSource="{Binding sortList}"/>

            <TextBox
Width="200"
VerticalAlignment="Center"
x:Name="searchFilterTextBox" 
                 Background="Cyan"
                Height="30"
KeyUp="searchFilterTextBox_KeyUp"/>
            <Button
                Name="AddProductButton"
                Content="Добавить продукт"
                Margin="5"
                Click="AddProductButton_Click"/>
           
            
        </WrapPanel>

        <ListBox
x:Name="PageListListBox"
ItemsSource="{Binding pageList}"
Grid.Column="1"
             Background="Aqua"
Grid.Row="2">

            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel 
            HorizontalAlignment="Left" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock 
            Margin="5"
            Text="{Binding}" 
            PreviewMouseDown="TextBlock_PreviewMouseDown"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        
        <Button
x:Name="CostChangeButton"
Visibility="{Binding costChangeButtonVisible}"     Content="Изменить стоимость на:"
        Click="CostChangeButton_Click"
        Background="MediumPurple" 
        />
        <Image 
            
            Grid.RowSpan="5"
            
        Source="foto/1.jpg"
            
            
        />
        <StackPanel 
            
            Grid.Row="3"
        Orientation="Vertical"
        
        VerticalAlignment="Bottom">
            <Button 
            x:Name="ExitButton"
            Content="Выход" 
            Click="ExitButton_Click"
                Background="MediumPurple"
            Height="auto"/>
        </StackPanel>
        

        <WrapPanel
            
Orientation="Horizontal"
Grid.Column="1"
MinHeight="50">
        </WrapPanel>
        


    </Grid>

</Window>