<Page x:Class="Muzzle.Main"
      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:Muzzle"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Main">
    <Page.Resources>
        <DataTemplate x:Key="NamordnikInfo">
            <Border BorderBrush="Black" BorderThickness="1" Margin="10">
            <StackPanel Orientation="Horizontal" Width="800" Height="100" Margin="10">
                <Image Source="{Binding Image}" Width="80" Height="80"/>
                <StackPanel Margin="10" VerticalAlignment="Center" HorizontalAlignment="Left">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Title}"/>
                        <TextBlock Text=" | "/>
                        <TextBlock Text="{Binding ProductType.Title}"/>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{Binding ArticleNumber}"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Материалы: "/>
                        <TextBlock Text="{Binding Material.Title}"  Loaded="TextBlock_Loaded" Tag="{Binding ID}"/>
                    </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Button x:Name="btnRed" Content="Редактировать" Width="100" Height="20" Margin="5" Click="btnIzmena_CLick"></Button>
                        </StackPanel>
                </StackPanel>
                <TextBlock Text="{Binding Material.Cost}" Loaded="TextBlock_Loaded_1" Tag="{Binding ID}" VerticalAlignment="Center"/>
                <TextBlock Text=" руб."  VerticalAlignment="Center"/>
                    
                </StackPanel>
            </Border>
        </DataTemplate>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="15*"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Margin="0,10">
            <TextBox Width="380" Height="20" Name="Search" Margin="20,0,10,0" TextChanged="TextBox_TextChanged"/>
            <ComboBox Width="190" Height="20" SelectedIndex="{Binding Sort}" Margin="10,0" SelectionChanged="ComboBox_Selected">
                <ComboBoxItem Content="Наименование (по возрастанию)"/>
                <ComboBoxItem Content="Наименование (по убыванию)"/>
                <ComboBoxItem Content="Номер цеха (по возрастанию)"/>
                <ComboBoxItem Content="Номер цеха (по убыванию)"/>
                <ComboBoxItem Content="Минимальная стоимость (по возрастанию)"/>
                <ComboBoxItem Content="Минимальная стоимость (по убыванию)"/>
            </ComboBox>
            <ComboBox x:Name="You" Width="190" Height="20" Margin="10,0,0,0" SelectionChanged="ComboBox_SelectionChanged"/>
            
        </StackPanel>
        <ListBox x:Name="listBoxNamordnik" Grid.Row="1" ItemTemplate="{StaticResource NamordnikInfo}"/>
        <StackPanel Grid.Row="2" Margin="0,10,0,0">
            <Button x:Name="btnDobby" Content="Добавить продукцию" Width="130" Height="20" Margin="0" Click="btnDobby_Click"></Button>
        </StackPanel>
    </Grid>
</Page>
