<Page x:Class="Esoft.Pages.AddEditPage"
      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:sys="clr-namespace:System;assembly=mscorlib"
      xmlns:local="clr-namespace:Esoft.Pages"
      mc:Ignorable="d" 
      d:Height="630" d:Width="820"
      Title="AddEditPage">

    <Grid>
        <StackPanel Orientation="Vertical" Height="550" VerticalAlignment="Top">
            <StackPanel Orientation="Vertical">
                <TextBlock Text="Название задачи:" FontSize="25" FontFamily="Comic Sans Ms" Foreground="#52a8ff" HorizontalAlignment="Left" Width="210" Margin="50,0,0,5"/>
                <TextBox x:Name="TaskNameTB" Width="770" Text="{Binding Title}" Style="{DynamicResource AddTaskTB}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <StackPanel Orientation="Vertical" Width="410">
                    <TextBlock Text="Описание задачи:" FontSize="25" FontFamily="Comic Sans Ms" Foreground="#52a8ff" HorizontalAlignment="Left" Width="220" Margin="50,10,0,5"/>
                    <TextBox x:Name="TaskDescriptionTB" Text="{Binding Description}" Padding="-20 -5 0 0" Height="235" Width="370" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="25,0,0,0" Style="{DynamicResource AddTaskTB}" VerticalContentAlignment="Top"/>
                </StackPanel>
                <StackPanel Width="410" Orientation="Vertical">
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Cтатус задачи:" FontSize="25" FontFamily="Comic Sans Ms" Foreground="#52a8ff" HorizontalAlignment="Left" Width="220" Margin="40,10,0,5"/>
                        <ComboBox Style="{DynamicResource ComboBoxStyle1}" ItemContainerStyle="{DynamicResource AddTaskCmbItem}" x:Name="CmbStatus" Text="{Binding Status}" DisplayMemberPath="Name" Width="370" HorizontalAlignment="Left" Margin="10,0,0,0"/>
                    </StackPanel>

                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Характер задачи:" FontSize="25" FontFamily="Comic Sans Ms" Foreground="#52a8ff" HorizontalAlignment="Left" Width="220" Margin="40,10,0,5"/>
                        <ComboBox x:Name="CmbTaskType" Style="{DynamicResource ComboBoxStyle1}" ItemContainerStyle="{DynamicResource AddTaskCmbItem}"  Text="{Binding WorkType}" DisplayMemberPath="Name" Width="370" HorizontalAlignment="Left" Margin="10,0,0,0"/>
                    </StackPanel>

                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Сложность задачи:" FontSize="25" FontFamily="Comic Sans Ms" Foreground="#52a8ff" HorizontalAlignment="Left" Width="220" Margin="40,10,0,5"/>
                        <TextBox x:Name="DifficultyTB" Text="{Binding Difficulty}" Width="370" Style="{DynamicResource AddTaskTB}" HorizontalAlignment="Left" Margin="10,0,0,0"
                                 TextInput="DifficultyTB_TextInput" TextChanged="DifficultyTB_TextChanged"/>
                    </StackPanel>
                </StackPanel>

            </StackPanel>

            <StackPanel Orientation="Vertical">
                <TextBlock Text="Исполнитель:" FontSize="25" FontFamily="Comic Sans Ms" Foreground="#52a8ff" HorizontalAlignment="Left" Width="220" Margin="50,0,0,5"/>
                <!--<ComboBox x:Name="CmbExecutor" Style="{DynamicResource ComboBoxStyle1}" ItemContainerStyle="{DynamicResource AddTaskCmbItem}" Text="{Binding ExecutorID}" DisplayMemberPath="ID" Width="770" HorizontalAlignment="Left" Margin="25,0,0,0"/>-->
                <ComboBox x:Name="CmbExecutor" Text="{Binding ExecutorID}" SelectedValuePath="ID" Style="{DynamicResource ComboBoxStyle1}" ItemContainerStyle="{DynamicResource AddTaskCmbItem}" Width="770" HorizontalAlignment="Left" Margin="25,0,0,0">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock>
                                <TextBlock.Text>
                                    <MultiBinding StringFormat="{}{0}{1} {2}">
                                        <Binding Path="FirstName"/>
                                        <Binding Path="MiddleName"/>
                                        <Binding Path="LastName"/>
                                    </MultiBinding>
                                </TextBlock.Text>
                            </TextBlock>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
            </StackPanel>

            <StackPanel Orientation="Horizontal">
                <StackPanel Orientation="Vertical" Width="275">
                    <TextBlock Text="Срок исполнения:" FontSize="25" FontFamily="Comic Sans Ms" Foreground="#52a8ff" HorizontalAlignment="Left" Width="220" Margin="30,10,0,5"/>
                    <DatePicker Style="{DynamicResource DatePickerStyle1}"  CalendarStyle="{DynamicResource DPCalendarStyle}" Name="DPDeadLine" Tag="Выбор даты" SelectedDate="{x:Static sys:DateTime.Now}" Margin="25,0,0,0"/>
                </StackPanel>
                <StackPanel Orientation="Vertical" Width="275">
                    <TextBlock Text="Дата выполнения:" FontSize="25" FontFamily="Comic Sans Ms" Foreground="#52a8ff" HorizontalAlignment="Left" Width="220" Margin="25,10,0,5"/>
                    <DatePicker Name="DPCreateDateTime"  Style="{DynamicResource DatePickerStyle1}" CalendarStyle="{DynamicResource DPCalendarStyle}" Tag="Выбор даты" SelectedDate="{x:Static sys:DateTime.Now}" Margin="15,0,10,0"/>
                </StackPanel>
                <StackPanel Orientation="Vertical" Width="270">
                    <TextBlock Text="Время выполнения:" FontSize="25" FontFamily="Comic Sans Ms" Foreground="#52a8ff" HorizontalAlignment="Left" Width="240" Margin="10,10,0,5"/>
                    <TextBox x:Name="TimeTB" Text="{Binding Time}" Margin="10,0,25,0" Style="{DynamicResource AddTaskTB}"/>
                </StackPanel>
            </StackPanel>
        </StackPanel>


        <StackPanel Width="700" Height="70" Orientation="Horizontal" VerticalAlignment="Bottom" Margin="0,20,0,5">
            <Button x:Name="BtnCancel" Content="Отмена" Style="{StaticResource AuthoButtons}" Click="BtnCancel_Click"/>
            <Button x:Name="BtnSaveTask" Content="Сохранить" Style="{StaticResource AuthoButtons}" Margin="100,0,0,0" Click="BtnSaveTask_Click"/>
        </StackPanel>

    </Grid>
</Page>
