<Window x:Class="PPC.WindowTasks"
        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:PPC"
        mc:Ignorable="d"
        Title="Задачи" Height="1080" Width="1450">
    <Window.Resources> 
        <Style x:Key="Text1">
            <Setter Property="TextBlock.FontFamily" Value="Abel [RUS by Daymarius]"/>
            <Setter Property="TextBlock.FontSize" Value="50"/>
            <Setter Property="TextBlock.Foreground" Value="Black"/>
            <Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
        </Style>
        <Style x:Key="Text2">
            <Setter Property="TextBlock.FontFamily" Value="Kadwa"/>
            <Setter Property="TextBlock.FontSize" Value="30"/>
            <Setter Property="TextBlock.Foreground" Value="Black"/>
            <Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
        </Style>
        <Style x:Key="Text3">
            <Setter Property="TextBlock.FontFamily" Value="Kadwa"/>
            <Setter Property="TextBlock.FontSize" Value="22"/>
            <Setter Property="TextBlock.Foreground" Value="Black"/>
            <Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
            <Setter Property="TextBlock.Height" Value="70"/>
        </Style>
        <Style x:Key="Text4">
            <Setter Property="TextBlock.FontFamily" Value="Abel [RUS by Daymarius]"/>
            <Setter Property="TextBlock.FontSize" Value="36"/>
            <Setter Property="TextBlock.Foreground" Value="Black"/>
            <Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
            <Setter Property="TextBlock.Height" Value="70"/>
            <Setter Property="TextBlock.Margin" Value="10"/>
        </Style>
        <Style x:Key="Text5">
            <Setter Property="TextBlock.FontFamily" Value="Abel [RUS by Daymarius]"/>
            <Setter Property="TextBlock.FontSize" Value="22"/>
            <Setter Property="TextBlock.Foreground" Value="Black"/>
            <Setter Property="TextBlock.VerticalAlignment" Value="Center"/>            
        </Style>
        <Style TargetType="{x:Type TabItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <Border>
                            <Grid>
                                <Grid>
                                    <Border x:Name="border" 
                                            Background="Silver"/>
                                </Grid>
                                <ContentPresenter ContentSource="Header"
                                                      HorizontalAlignment="Center"
                                                      VerticalAlignment="Center"
                                                  Style="{StaticResource Text5}"/>
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver"
                                     Value="True">
                                <Setter TargetName="border"
                                        Property="Background"
                                        Value="Silver" />
                            </Trigger> 
                            <Trigger Property="IsSelected"
                                     Value="True">
                                <Setter TargetName="border"
                                        Property="Background"                                        
                                        Value="#E84545" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="but1" TargetType="Button">
            <Setter Property="Margin" Value="10"/>
            <Setter Property="Background" Value="#E84545"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Height" Value="50"/>
            <Setter Property="TextBlock.FontFamily" Value="Abel [RUS by Daymarius]"/>
            <Setter Property="TextBlock.FontSize" Value="22"/>
            <Setter Property="TextBlock.Foreground" Value="Black"/>
            <Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border Background="{TemplateBinding Background}">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#F88D8D"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Background" Value="#E84545"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid Background="#2B2E4A">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>            
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1.5*"></ColumnDefinition>
            <ColumnDefinition Width="2.5*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Background="White" Margin="15,10,15,10">
            <StackPanel Orientation="Horizontal">
                <Image Source="/WindowTasks/Avatarka.png" Height="100" Width="100" Margin="10"/>
                <TextBlock Style="{StaticResource Text1}" >
                    <TextBlock.Text>
                        <MultiBinding StringFormat="{}{0} {1}">
                            <Binding Path="Name" />
                            <Binding Path="Surname" />
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </StackPanel>
            <Line X1="800" Y1="0" X2="0" Y2="0" Stroke="#2B2E4A" StrokeThickness="7"></Line>
            <StackPanel Orientation="Horizontal" Margin="10">
                <TextBlock  Style="{StaticResource Text1}">Задачи</TextBlock>
            </StackPanel>
            <TabControl Margin="0" x:Name="ListTab" TabStripPlacement="Bottom" SelectionChanged="ClicToTab">
                <TabItem Header="Активные" x:Name="tabActive"  Width="250" Height="40" Margin="0">
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" CanContentScroll="True" Height="700" Margin="0 5 5 10">
                        <ListBox BorderThickness="0" ItemsSource="{Binding Active_task}" SelectedItem="{Binding SelectedTask}" Width="auto" Height="auto">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel  Orientation="Vertical" Width="650">
                                        <StackPanel Orientation="Horizontal" Height="50" Margin="10">
                                            <Ellipse Fill="#E84545" Width="16" Height="16"></Ellipse>
                                            <TextBlock Style="{StaticResource Text2}" TextTrimming="CharacterEllipsis" Text="{Binding Path=Name_task}" Margin="12 0 0 0"/>
                                        </StackPanel>
                                        <TextBlock Style="{StaticResource Text3}" TextWrapping="Wrap" MaxHeight="60" Margin="10 0 0 0" Text="{Binding Path=Description_task}"/>
                                    </StackPanel>  
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </ScrollViewer> 
                </TabItem>
                <TabItem x:Name="tabComplete" Header="Завершенные" Width="250" Height="40" >
                    <ScrollViewer HorizontalScrollBarVisibility ="Disabled" VerticalScrollBarVisibility="Auto" CanContentScroll="True"  Height="700"  Margin="0 5 5 10">
                        <ListBox BorderThickness="0" ItemsSource="{Binding Complete_task}" SelectedItem="{Binding SelectedTask}" Margin="0" Width="auto" Height="auto">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Vertical">
                                        <StackPanel Orientation="Horizontal" Height="50" Margin="10">
                                            <Ellipse Fill="#E84545" Width="16" Height="16"></Ellipse>
                                            <TextBlock Style="{StaticResource Text2}" TextTrimming="CharacterEllipsis" Text="{Binding Path=Name_task}" Margin="12 0 0 0"/>
                                        </StackPanel>
                                        <TextBlock Style="{StaticResource Text3}"  Margin="10 0 0 0" Text="{Binding Path=Description_task}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </ScrollViewer>
                </TabItem>              
            </TabControl>
        </StackPanel>
        <StackPanel DataContext="{Binding SelectedTask}" Grid.Row="0" Grid.Column="1" Background="White" Margin="10">
            <TextBlock Style="{StaticResource Text1}" Text="{Binding Name_task, UpdateSourceTrigger=PropertyChanged}" Margin="10 15 0 20" Foreground="Black"/>
            <StackPanel Orientation="Horizontal">
                <TextBlock Style="{StaticResource Text4}" Width="365">Дата начала</TextBlock>
                <TextBlock Style="{StaticResource Text4}" Text="{Binding Date_start_job, UpdateSourceTrigger=PropertyChanged}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Style="{StaticResource Text4}"  Width="365">Дата окончания</TextBlock>
                <TextBlock Style="{StaticResource Text4}" Text="{Binding Date_finish_job, UpdateSourceTrigger=PropertyChanged}"/>
            </StackPanel>
            <Border Margin="10 0 10 0" BorderBrush="Silver" BorderThickness="1" CornerRadius="8,8,3,3">
                <ScrollViewer HorizontalScrollBarVisibility ="Disabled" CanContentScroll="True" VerticalScrollBarVisibility ="Hidden" Height="630">
                    <StackPanel Margin="10">
                        <TextBlock  Style="{StaticResource Text4}" TextWrapping="WrapWithOverflow" Text="{Binding Description_task, UpdateSourceTrigger=PropertyChanged}" Height="auto"/>
                    </StackPanel>
                </ScrollViewer>
            </Border>
            <Button x:Name="but_complete" Style="{StaticResource but1}" Click="Complete_task">Выполнено</Button>
        </StackPanel>
    </Grid>
</Window>
