<Page x:Class="Esoft.Pages.TaskList"
      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:Esoft.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="620" d:DesignWidth="750"
      Title="TaskList">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.RowSpan="2" Width="725">

            <ComboBox Margin="50,10" Padding="10 -1" Width="250" Height="40" Name="CmbStatusSort" FontSize="25" Text="{Binding Status}" DisplayMemberPath="Name" Style="{DynamicResource ComboBoxStyle1}" ItemContainerStyle="{DynamicResource AddTaskCmbItem}" LostFocus="CmbStatusSort_LostFocus" SelectionChanged="CmbStatusSort_SelectionChanged" >
            </ComboBox>


            <Separator Background="Transparent" BorderThickness="0" Width="7"/>
            <!--<ComboBox Margin="5" Padding="6 5" Width="200" Height="40" Name="CmbExecutorSort" FontSize="20" DisplayMemberPath="" SelectedValuePath="ID" Text="{Binding ExecutorID}" Style="{DynamicResource ComboBoxStyle1}" ItemContainerStyle="{DynamicResource AddTaskCmbItem}" />-->

            <Separator Background="Transparent" BorderThickness="0" Width="7"/>
            <TextBox Name="TBoxSearch" Padding="10,-5,0,0" Tag="Поиск" Width="250" Height="40" Margin="0,0,20,0" FontSize="25" HorizontalAlignment="Right" Style="{DynamicResource AddTaskTB}" TextChanged="TBoxSearch_TextChanged" />

            <Separator Background="Transparent" BorderThickness="0" Width="7"/>
            <Button Name="ClearFilters" Width="45" Height="45" Style="{DynamicResource ClearSort}" Click="ClearFilters_Click">
                <Image Source="/Resources/ClearFilter.png" />

            </Button>

        </StackPanel>
        <DataGrid RowStyle="{DynamicResource DataGridRowStyle1}" ColumnHeaderStyle="{DynamicResource DataGridColumnHeaderStyle1}" Style="{DynamicResource DataGridStyle1}" Grid.Row="2" x:Name="DGTasks" AutoGenerateColumns="False" IsReadOnly="True" ItemsSource="{Binding}" RenderTransformOrigin="0.5,0.5" Margin="10,0,12,45">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Задача" Binding="{Binding Title}" Width="320"/>
                <DataGridTextColumn Header="Статус" Binding="{Binding Status}" Width="80"/>
                <DataGridTextColumn Header="Исполнитель" Binding="{Binding Executor.User.MiddleName}" Width="140"/>
                <DataGridTextColumn Header="Менеджер" Width="*" Binding="{Binding Executor.Manager.User.MiddleName}"/>
                <DataGridTemplateColumn Width="auto">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Name="BtnEdit" Width="40" Height="40" Click="BtnEdit_Click" Style="{DynamicResource EditTaskButton}">
                                <Image Source="/Resources/EditTask.png" />
                            </Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>

        <Button Content="Добавить" Grid.Row="2" Style="{DynamicResource AddDeleteBtn}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="100,5" Click="BtnAdd_Click" FontFamily="Arial Black"/>
        <Button Content="Удалить" Name="BtnDelTask" Grid.Row="2" Style="{DynamicResource AddDeleteBtn}"  HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,5" Click="BtnDelTask_Click" FontFamily="Arial Black"/>

    </Grid>
</Page>
