<UserControl x:Class="PPC.PersonalPage.AuthData"
             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:PPC.PersonalPage"
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
             mc:Ignorable="d" 
             d:DesignWidth="800"
             d:DesignHeight="800"
             Background="White">
    <UserControl.Resources>
        <Style TargetType="TextBlock" x:Key = "TextForSettings">
            <Setter Property="FontFamily" Value ="Abel [RUS by Daymarius]"/>
            <Setter Property="FontSize" Value="36"/>
            <Setter Property="Foreground" Value = "Black"/>
        </Style>
        <Style TargetType="TextBlock" x:Key = "TextForButton">
            <Setter Property="FontFamily" Value ="Kadwa"/>
            <Setter Property="FontSize" Value="30"/>
            <Setter Property="Foreground" Value = "White"/>
            <Setter Property="FontWeight" Value="Bold"/>
        </Style>
        <Style TargetType="TextBox" x:Key="SettingsFields">
            <Setter Property="Height" Value="60"/>
            <Setter Property="Margin" Value="0 10 0 0"/>
            <Setter Property="FontSize" Value="28"/>
            <Setter Property="Foreground" Value="Gray"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border BorderThickness = "0 0 0 1" BorderBrush="Black">
                            <ScrollViewer x:Name ="PART_ContentHost"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="PasswordBox" x:Key="PasswordFileds">
            <Setter Property="Height" Value="60"/>
            <Setter Property="Margin" Value="0 10 0 0"/>
            <Setter Property="FontSize" Value="28"/>
            <Setter Property="Foreground" Value="Gray"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border BorderThickness = "0 0 0 1" BorderBrush="Black">
                            <ScrollViewer x:Name ="PART_ContentHost"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ApplyButton"
               TargetType="Button">
            <Setter Property="Background" Value="#2B2E4A"/>
            <Setter Property="Height" Value="100"/>
            <Setter Property="Width" Value="500"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border Background="{TemplateBinding Background}"
                                CornerRadius="50"
                                Height="{TemplateBinding Height}"
                                Width="{TemplateBinding Width}">
                            <ContentControl HorizontalAlignment="Center"
                                              VerticalAlignment="Center">
                                <TextBlock Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}"
                                           Style="{StaticResource TextForButton}"/>
                            </ContentControl>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding StateOfSettings}" Value="SettingsChanged">
                    <Setter Property="Background" Value="#E84545"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding StateOfSettings}" Value="SettingsNotChanged">
                    <Setter Property="Background" Value="#2B2E4A"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="150" />
            <RowDefinition Height="150" />
            <RowDefinition Height="150" />
            <RowDefinition/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Margin="10,10,10,10" Grid.RowSpan="2">
            <TextBlock Style="{StaticResource TextForSettings}">Электронная почта</TextBlock>
            <TextBox Style="{StaticResource SettingsFields}" Text="{Binding Email, UpdateSourceTrigger=PropertyChanged}"/>
        </StackPanel>
        <StackPanel Grid.Row="1" Grid.Column="0" Margin="10,10,10,10" Grid.RowSpan="2">
            <TextBlock Style="{StaticResource TextForSettings}">Старый пароль</TextBlock>
            <PasswordBox x:Name="OldPass" Style="{StaticResource PasswordFileds}">
                <i:Interaction.Behaviors>
                    <local:PasswordBehavior Password="{Binding Oldpass, Mode=TwoWay}"/>
                </i:Interaction.Behaviors>
            </PasswordBox>
        </StackPanel>
        <StackPanel Grid.Row="2" Grid.Column="0" Margin="10,10,10,10" Grid.RowSpan="2">
            <TextBlock Style="{StaticResource TextForSettings}">Новый пароль</TextBlock>
            <PasswordBox x:Name="NewPass" Style="{StaticResource PasswordFileds}">
                <i:Interaction.Behaviors>
                    <local:PasswordBehavior Password="{Binding Newpass, Mode=TwoWay}"/>
                </i:Interaction.Behaviors>
            </PasswordBox>
        </StackPanel>
        <Button Grid.Column="0"
                Grid.Row="3"
                Margin="0 70 0 0"
                Style="{StaticResource ApplyButton}"
                Command="{Binding ConfirmSettings}">ПОДТВЕРДИТЬ ИЗМЕНЕНИЯ
        </Button>
    </Grid>
</UserControl>
