Files
SamplePreSystem-CS/SamplePreSystemApp/LoginWindow.xaml

207 lines
7.9 KiB
Plaintext
Raw Normal View History

2026-04-30 11:34:41 +08:00
<Window
x:Class="SamplePreSystemApp.LoginWindow"
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:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:SamplePreSystemApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:pwd="clr-namespace:SamplePreSystem.UI.BaseControls;assembly=SamplePreSystem.UI"
xmlns:selfBehavior="clr-namespace:SamplePreSystem.UI.Behaviors;assembly=SamplePreSystem.UI"
Title="系统登录"
Width="800"
Height="480"
AllowsTransparency="True"
Background="Transparent"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
<Window.Resources>
<Style x:Key="InputStyle" TargetType="TextBox">
<Setter Property="Height" Value="42" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="10,0,10,0" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="#DCDFE6" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border
Background="White"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6">
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PwdInputStyle" TargetType="PasswordBox">
<Setter Property="Height" Value="42" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="10,0,10,0" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="#DCDFE6" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="PasswordBox">
<Border
Background="White"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6">
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Border
Margin="10"
Background="White"
CornerRadius="12">
<i:Interaction.Behaviors>
<selfBehavior:BorderMouseMoveBehavior />
</i:Interaction.Behaviors>
<Border.Effect>
<DropShadowEffect
BlurRadius="20"
Opacity="0.2"
ShadowDepth="0" />
</Border.Effect>
</Border>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image
Width="300"
Height="300"
Source="/SamplePreSystem.UI;component/Assets/login.png" />
<StackPanel
Grid.Column="1"
Margin="40,60"
VerticalAlignment="Center">
<!-- 标题 -->
<TextBlock
Margin="0,0,0,20"
HorizontalAlignment="Center"
FontSize="26"
FontWeight="Bold"
Foreground="#303133"
Text="系统登录" />
<!-- 账号 -->
<TextBlock
Margin="0,0,0,6"
FontSize="14"
Foreground="#606266"
Text="账号" />
<TextBox
x:Name="txtAccount"
Margin="0,0,0,10"
Style="{StaticResource InputStyle}"
Text="{Binding UserName}" />
<!-- 密码 -->
<TextBlock
Margin="0,0,0,6"
FontSize="14"
Foreground="#606266"
Text="密码" />
<PasswordBox
x:Name="txtPwd"
Margin="0,0,0,10"
pwd:PasswordAttaExt.CustomPwd="{Binding UserPwd, Mode=TwoWay}"
pwd:PasswordAttaExt.IsOpenPwdBading="True"
Style="{StaticResource PwdInputStyle}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="KeyDown">
<i:InvokeCommandAction Command="{Binding PwdKeyDownCommand}" PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
</PasswordBox>
<!-- 记住我 -->
<CheckBox
x:Name="ckb_saveUser"
Margin="0,0,0,10"
HorizontalAlignment="Left"
Content="记住用户"
FontSize="13"
Foreground="#909399"
IsChecked="{Binding IsSaveUser}" />
<!-- 登录按钮 -->
<Button
Height="48"
Background="#409EFE"
BorderThickness="0"
Command="{Binding LoginButtonClickCommand}"
Content="登 录"
FontSize="16"
FontWeight="Bold"
Foreground="White">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="6">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<!-- 取消按钮 -->
<Button
x:Name="btnCancel"
Height="48"
Margin="0,5"
Background="White"
Command="{Binding CancelClickCommand}"
Content="取 消"
FontSize="16"
FontWeight="Bold"
Foreground="Black">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border
Background="{TemplateBinding Background}"
BorderBrush="LightGray"
BorderThickness="1"
CornerRadius="6">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<TextBlock
FontSize="11"
Foreground="Red"
Text="{Binding ErrInfo}" />
</StackPanel>
</Grid>
</Grid>
</Window>