Files
IOT/LoginModule/Views/LoginView.xaml
2026-01-14 11:22:58 +08:00

164 lines
7.3 KiB
XML

<UserControl x:Class="LoginModule.Views.LoginView"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:helpers="clr-namespace:UIShare.Helpers;assembly=UIShare"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
prism:ViewModelLocator.AutoWireViewModel="True"
xmlns:local="clr-namespace:LoginModule.Views"
mc:Ignorable="d"
Height="315"
Width="420">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/UIShare;component/Styles/CommonStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- 这里是你的额外样式 -->
<Style TargetType="TextBox"
BasedOn="{StaticResource MahApps.Styles.TextBox}">
<Setter Property="FontSize"
Value="14" />
<Setter Property="BorderThickness"
Value="0,0,0,2" />
<Setter Property="BorderBrush"
Value="#E0E0E0" />
<Setter Property="Padding"
Value="5,8" />
<Setter Property="Background"
Value="Transparent" />
</Style>
<Style TargetType="PasswordBox"
BasedOn="{StaticResource MahApps.Styles.PasswordBox}">
<Setter Property="FontSize"
Value="14" />
<Setter Property="BorderThickness"
Value="0,0,0,2" />
<Setter Property="BorderBrush"
Value="#E0E0E0" />
<Setter Property="Padding"
Value="5,8" />
<Setter Property="Background"
Value="Transparent" />
</Style>
<Style TargetType="Button"
BasedOn="{StaticResource MahApps.Styles.Button.Flat}">
<Setter Property="FontSize"
Value="15" />
<Setter Property="FontWeight"
Value="SemiBold" />
<Setter Property="Foreground"
Value="White" />
<Setter Property="Background"
Value="#2196F3" />
<Setter Property="BorderThickness"
Value="0" />
<Setter Property="Margin"
Value="0,20,0,0" />
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<!-- 表单区域 -->
<Border Grid.Row="0"
Background="White"
Margin="20,20,20,0"
CornerRadius="5"
BorderThickness="1"
BorderBrush="#E0E0E0"
Padding="30,20">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="用户登录"
HorizontalAlignment="Center"
FontSize="15"
Padding="3" />
<StackPanel Grid.Row="1">
<!-- 用户名输入 -->
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal"
Margin="17">
<materialDesign:PackIcon Kind="Account"
VerticalAlignment="Center" />
<TextBox Text="{Binding Account}"
mah:TextBoxHelper.Watermark="请输入账号"
mah:TextBoxHelper.ClearTextButton="True"
VerticalContentAlignment="Center"
Width="180"
Height="30"
Padding="0" />
</StackPanel>
</StackPanel>
<!-- 密码输入 -->
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal"
Margin="7">
<materialDesign:PackIcon Kind="Lock"
VerticalAlignment="Center" />
<PasswordBox helpers:PasswordBoxHelper.Password="{Binding Password, Mode=TwoWay}"
mah:TextBoxHelper.Watermark="请输入密码"
mah:TextBoxHelper.ClearTextButton="True"
VerticalContentAlignment="Center"
Width="180"
Height="30"
Padding="0" />
</StackPanel>
<Label Content="注册账户"
HorizontalAlignment="Right"
Cursor="Hand">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<i:InvokeCommandAction Command="{Binding RegisterCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Label>
</StackPanel>
</StackPanel>
<!-- 登录按钮 -->
<Button Grid.Row="2"
Command="{Binding LoginCommand}"
Content="登 录"
Width="120"
Height="33"
mah:ControlsHelper.CornerRadius="5">
<Button.Effect>
<DropShadowEffect BlurRadius="8"
ShadowDepth="3"
Opacity="0.5" />
</Button.Effect>
</Button>
</Grid>
</Border>
<!-- 底部版权信息 -->
<TextBlock Grid.Row="2"
Text="© 2025 大学生学习交流平台"
Foreground="#777"
FontSize="12"
HorizontalAlignment="Center"
Margin="0,10" />
</Grid>
</UserControl>