|
- <Window
- x:Class="BPASmartClient.CustomResource.Pages.View.LoginView"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
- Title="LoginView"
- Width="1920"
- Height="1080"
- AllowsTransparency="True"
- Background="{x:Null}"
- Topmost="False"
- WindowStartupLocation="CenterScreen"
- WindowState="Normal"
- WindowStyle="None"
- mc:Ignorable="d">
-
- <Window.DataContext>
- <vm:LoginViewModel />
- </Window.DataContext>
-
- <Window.Resources>
- <Style x:Key="TxLogin" TargetType="TextBlock">
- <Setter Property="FontSize" Value="20" />
- <Setter Property="Foreground" Value="#ddd" />
- <Setter Property="HorizontalAlignment" Value="Center" />
- <Setter Property="VerticalAlignment" Value="Center" />
- </Style>
-
- <!--#region 密码输入框样式-->
- <Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="FontFamily" Value="Times New Roman" />
- <Setter Property="PasswordChar" Value="●" />
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
- <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
- <Setter Property="HorizontalContentAlignment" Value="Left" />
- <Setter Property="Padding" Value="1" />
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- <Setter Property="AllowDrop" Value="true" />
- <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
- <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
- <Setter Property="CaretBrush" Value="#009DFF" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type PasswordBox}">
- <Border
- x:Name="Bd"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="5"
- SnapsToDevicePixels="true">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="40" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <TextBlock
- x:Name="UserTextBlock"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontFamily="../../Fonts/#iconfont"
- FontSize="30"
- Foreground="{TemplateBinding BorderBrush}"
- Text="" />
-
- <!--<TextBlock
- Name="markText"
- Grid.Column="1"
- Margin="10,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- FontSize="20"
- Foreground="#88009dff"
- Text="请输入账号密码"
- Visibility="Collapsed" />-->
-
- <ScrollViewer
- x:Name="PART_ContentHost"
- Grid.Column="1"
- MinHeight="20"
- VerticalAlignment="Center"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Grid>
-
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsEnabled" Value="false">
- <Setter TargetName="Bd" Property="Opacity" Value="0.56" />
- <Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="Bd" Property="BorderBrush" Value="#FF7EB4EA" />
- <Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF7EB4EA" />
- </Trigger>
- <Trigger Property="IsKeyboardFocused" Value="true">
- <Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
- <Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
- </Trigger>
- <!--<DataTrigger Binding="{Binding Path=Password, RelativeSource={RelativeSource Mode=self}}" Value="">
- <Setter TargetName="markText" Property="Visibility" Value="Visible" />
- </DataTrigger>-->
-
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
- <Condition Property="IsSelectionActive" Value="false" />
- </MultiTrigger.Conditions>
- <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
- </MultiTrigger>
- </Style.Triggers>
- </Style>
- <!--#endregion-->
-
- <!--#region 用户输入框样式-->
- <Style x:Key="UserTextBoxStyle" TargetType="TextBox">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="CaretBrush" Value="#009DFF" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="TextBox">
- <Border
- x:Name="border"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="5"
- SnapsToDevicePixels="true">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="40" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <TextBlock
- x:Name="PasswordTextBlock"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontFamily="../../Fonts/#iconfont"
- FontSize="30"
- Foreground="{TemplateBinding BorderBrush}"
- Text="" />
-
- <TextBlock
- Name="markText"
- Grid.Column="1"
- Margin="10,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- FontSize="{TemplateBinding FontSize}"
- Foreground="#88009dff"
- Text="请输入账号名称"
- Visibility="Collapsed" />
-
-
- <ScrollViewer
- x:Name="PART_ContentHost"
- Grid.Column="1"
- MinHeight="20"
- VerticalAlignment="Center"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Grid>
-
- </Border>
-
- <ControlTemplate.Triggers>
- <Trigger Property="IsEnabled" Value="false">
- <Setter TargetName="border" Property="Opacity" Value="0.56" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
- </Trigger>
- <Trigger Property="IsKeyboardFocused" Value="true">
- <Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
- </Trigger>
- <DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
- <Setter TargetName="markText" Property="Visibility" Value="Visible" />
- </DataTrigger>
- </ControlTemplate.Triggers>
-
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
-
- <!--#region 操作按钮样式-->
- <Style x:Key="ButtonStyle" TargetType="Button">
- <Setter Property="Margin" Value="20,20" />
- <Setter Property="Background" Value="#cc009DFF" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="FontSize" Value="30" />
- <Setter Property="Foreground" Value="White" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Button">
- <Border
- Name="TitleBarBr"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="20">
- <ContentPresenter
- Margin="{TemplateBinding Margin}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="TitleBarBr" Property="Background" Value="#009DFF" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
-
- </Window.Resources>
-
- <Grid>
- <MediaElement
- Name="player"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- LoadedBehavior="Manual" />
-
- <Grid x:Name="grid" Margin="400,180">
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition />
- <RowDefinition />
- <RowDefinition />
- <RowDefinition />
- </Grid.RowDefinitions>
-
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontSize="40"
- Foreground="#009DFF"
- Text="用户登录" />
-
- <TextBlock
- Grid.Row="4"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontSize="30"
- Foreground="#FFEF2020"
- Text="{Binding ErrorInfo}" />
-
- <TextBox
- Name="Username"
- Grid.Row="1"
- Margin="20,20"
- BorderBrush="#009DFF"
- BorderThickness="3"
- FontSize="30"
- Foreground="#009DFF"
- KeyDown="TextBox_KeyDown"
- Style="{DynamicResource UserTextBoxStyle}"
- TabIndex="1"
- Text="{Binding UserName}" />
-
- <PasswordBox
- Name="pb"
- Grid.Row="2"
- Margin="20,20"
- common:PasswordHelper.Attach="True"
- common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- BorderBrush="#009DFF"
- BorderThickness="3"
- FontSize="30"
- Foreground="#009DFF"
- KeyDown="pb_KeyDown"
- PasswordChanged="PasswordBox_PasswordChanged"
- Style="{DynamicResource PasswordBoxStyle}"
- TabIndex="2" />
-
- <TextBlock
- Name="markText"
- Grid.Row="2"
- Margin="70,5"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- FontSize="30"
- Foreground="#88009dff"
- IsHitTestVisible="False"
- Text="请输入账号密码"
- Visibility="Visible" />
-
- <Grid Grid.Row="3">
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
-
- <Button
- Command="{Binding ExitCommand}"
- Content="退 出"
- Style="{StaticResource ButtonStyle}" />
-
- <Button
- Grid.Column="1"
- Command="{Binding LoginCommand}"
- Content="登 录"
- Style="{StaticResource ButtonStyle}"
- TabIndex="3" />
-
- </Grid>
- </Grid>
- </Grid>
- </Window>
|