<Page x:Class="Session1.AgentList"
      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:Session1"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="600"
      Title="AgentList">
    <Page.Resources>
        <DataTemplate x:Key="lbItem" >
            <Border Grid.Row="1" BorderBrush="Black" BorderThickness="1">
                <StackPanel Background="{Binding AgentBackground}" Height="110" Width="580" Orientation="Horizontal">
                    <Image Source="{Binding AgentImage}" Height="100" Width="100" HorizontalAlignment="Left"/>
                    <StackPanel Orientation="Vertical" Margin="10" Width="350">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock FontSize="18" Text="{Binding AgentType.Title}"></TextBlock>
                            <TextBlock FontSize="18" Margin="5, 0">|</TextBlock>
                            <TextBlock FontSize="18" Text="{Binding Title}"></TextBlock>
                        </StackPanel>
                        <TextBlock FontSize="16" Text="{Binding AgentSales}"></TextBlock>
                        <TextBlock FontSize="16" Text="{Binding Phone}"></TextBlock>
                        <TextBlock FontSize="16" Text="{Binding AgentPriority}"></TextBlock>
                    </StackPanel>
                    <TextBlock FontSize="24" Margin="10" HorizontalAlignment="Right" Text="{Binding AgentSaleSizeString}"></TextBlock>
                </StackPanel>
            </Border>
        </DataTemplate>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="55*"/>
            <RowDefinition Height="353*"/>
            <RowDefinition Height="42*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Margin="10" Orientation="Horizontal">
            <TextBox x:Name="search" Width="300" TextChanged="search_TextChanged"></TextBox>
            <ComboBox x:Name="sort" Width="130" Margin="10, 0" SelectionChanged="sort_SelectionChanged">
                <ComboBoxItem>Наименование возр.</ComboBoxItem>
                <ComboBoxItem>Наименование убыв.</ComboBoxItem>
                <ComboBoxItem>Скидка возр.</ComboBoxItem>
                <ComboBoxItem>Скидка убыв.</ComboBoxItem>
                <ComboBoxItem>Приоритет возр.</ComboBoxItem>
                <ComboBoxItem>Приоритет убыв.</ComboBoxItem>
            </ComboBox>
            <ComboBox x:Name="filter" Width="130" SelectionChanged="filter_SelectionChanged">
                <ComboBoxItem>Все типы</ComboBoxItem>
            </ComboBox>
        </StackPanel>
        <ListBox x:Name="agentList" Grid.Row="1" ItemTemplate="{DynamicResource lbItem}" SelectionChanged="agentList_SelectionChanged" SelectionMode="Extended" MouseDoubleClick="agentList_MouseDoubleClick"></ListBox>
        <StackPanel Grid.Row="2" Orientation="Horizontal">
            <Button x:Name="addAgent" Click="addAgent_Click">Добавить</Button>
            <Button x:Name="changePriority" Visibility="Hidden" Click="ChangePriority_Click">Изменить приоритет на ...</Button>
        </StackPanel>
        
    </Grid>
</Page>
