<UserControl xmlns="https://github.com/avaloniaui"
             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:vwms="clr-namespace:detect.gui.VWMS"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="detect.gui.VWS.LoginControl"
             x:DataType="vwms:LoginControlModel">
    <Grid>
        <Border Background="{StaticResource DialogBackground}" />
        <Border HorizontalAlignment="Center"
                VerticalAlignment="Center"
                CornerRadius="10"
                BoxShadow="{StaticResource LoginDialogShadows}">
            <Border.Background>
                <SolidColorBrush Color="#2D77F3" Opacity="0.3"></SolidColorBrush>
            </Border.Background>
            <Grid ColumnDefinitions="30, 1*, 1, 1*">
                <Border Grid.Column="1" Width="460" Height="460" HorizontalAlignment="Center" VerticalAlignment="Center">
                    <Border.Background>
                        <ImageBrush Source="avares://detect.gui/Assets/Images/login.png" Stretch="Fill" />
                    </Border.Background>
                </Border>
                <Border Grid.Column="2" Height="250">
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0% 0%" EndPoint="0% 100%">
                            <GradientStop Offset="0.0" Color="Transparent" />
                            <GradientStop Offset="0.2" Color="#3A62CB" />
                            <GradientStop Offset="0.5" Color="#34DEFC" />
                            <GradientStop Offset="0.8" Color="#3A62CB" />
                            <GradientStop Offset="1" Color="Transparent" />
                        </LinearGradientBrush>
                    </Border.Background>
                </Border>
                <Border Grid.Column="3" Margin="70, 0, 70, 0"
                        VerticalAlignment="Center"
                        CornerRadius="5"
                        Width="340">
                    <StackPanel>
                        <StackPanel Orientation="Horizontal"
                                    HorizontalAlignment="Center">
                            <PathIcon Classes="login-user">
                                <PathIcon.Foreground>
                                    <LinearGradientBrush StartPoint="0% 0%" EndPoint="0% 100%">
                                        <GradientStop Offset="0.0" Color="#34DEFC" />
                                        <GradientStop Offset="0.5" Color="#FFFFFF" />
                                        <GradientStop Offset="1.0" Color="#34DEFC" />
                                    </LinearGradientBrush>
                                </PathIcon.Foreground>
                            </PathIcon>
                            <Border Width="10" />
                            <TextBlock Classes="login-header" Text="欢迎登录">
                                <TextBlock.Foreground>
                                    <LinearGradientBrush StartPoint="0% 0%" EndPoint="0% 100%">
                                        <GradientStop Offset="0.0" Color="#34DEFC" />
                                        <GradientStop Offset="0.5" Color="#FFFFFF" />
                                        <GradientStop Offset="1.0" Color="#34DEFC" />
                                    </LinearGradientBrush>
                                </TextBlock.Foreground>
                            </TextBlock>
                        </StackPanel>
                        <Border Margin="0,30,0,0">
                            <Grid RowDefinitions="*,20,*,10,*,20,*">
                                <TextBox Grid.Row="0"
                                         Name="TbUsername"
                                         Height="36"
                                         Classes="login"
                                         Text="{Binding Username}"
                                         Watermark="用户名" />
                                <TextBox Grid.Row="2"
                                         Name="TbPassword"
                                         Height="36"
                                         Classes="login"
                                         PasswordChar="*"
                                         Text="{Binding Password}"
                                         Watermark="密码" />
                                <TextBlock Name="TbErrorMessage" Grid.Row="4" />
                                <Button Grid.Row="6"
                                        Name="BtnLogin"
                                        Width="{Binding Path=Bounds.Width, ElementName=TbUsername}"
                                        Height="{Binding Path=Bounds.Height, ElementName=TbUsername}"
                                        Classes="rect-button blue login"
                                        Content="登录"
                                        IsEnabled="{Binding !IsLoading}"
                                        Command="{Binding LoginCommand}"/>
                            </Grid>
                        </Border>
                    </StackPanel>
                </Border>
            </Grid>
        </Border>
    </Grid>    
</UserControl>
