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

    <Page.Resources>
        <DataTemplate x:Key="ListAgentD">
            <Border BorderBrush="Black" BorderThickness="2" >
                <StackPanel Orientation="Horizontal" Background="{Binding grencolor}">
                    <StackPanel Orientation="Horizontal" Width="600">
                        <Image Height="100" Width="100" Source="{Binding Logo}"/>
                        <StackPanel Orientation="Vertical">
                            <TextBlock Text="{Binding typea}">
                            <Run Text=" | "/>
                            <Run Text="{Binding Title}"/>
                            </TextBlock>
                            <TextBlock Text="{Binding counts}">
                            <Run Text=" продаж за год"/>
                            </TextBlock>
                            <TextBlock Text="{Binding Phone}"/>
                            <TextBlock Text="Приоритетность:">
                            <Run Text="{Binding Priority}"/>
                            </TextBlock>
                        </StackPanel>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{Binding skidka}" Margin="0 0 0 10" Width="40">
                            <Run Text="%" />
                        </TextBlock>
                    </StackPanel>
                </StackPanel>
            </Border>
        </DataTemplate>
    </Page.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="50"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="60"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.ColumnSpan="2" Orientation="Horizontal">
            <GroupBox Header="Поиск"  Width="150">
                <TextBox x:Name="searchBar" TextChanged="searchBar_TextChanged" />
            </GroupBox>
            <GroupBox Header="Сортировка">
                <ComboBox Name="SortCMB" SelectionChanged="SortCMB_SelectionChanged">
                    <ComboBoxItem Content="Без сортировки"/>
                    <ComboBoxItem Content="Наименование ↑"/>
                    <ComboBoxItem Content="Наименование ↓"/>
                    <ComboBoxItem Content="Размер скидки ↑"/>
                    <ComboBoxItem Content="Размер скидки ↓"/>
                    <ComboBoxItem Content="Приоритет агента ↑"/>
                    <ComboBoxItem Content="Приоритет агента ↓"/>
                </ComboBox>
            </GroupBox>

            <GroupBox Header="Фильтрация">
                <ComboBox Name="FilterCmb" SelectionChanged="FilterCmb_SelectionChanged"/>
            </GroupBox>
            <Button x:Name="ChangePrior" Content="Изменить приоритет на ..." Height="45" Visibility="Collapsed" Click="ChangePrior_Click"/>
        </StackPanel>
        <ListView x:Name="AgentList" ItemTemplate="{StaticResource ListAgentD}" Grid.ColumnSpan="2" Grid.Row="1" SelectionMode="Extended" SelectionChanged="AgentList_SelectionChanged"/>
    </Grid>
</Page>
