123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- <Window x:Class="LampInspectionMachine.Views.RoleLoginView"
- 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:LampInspectionMachine.Views"
- xmlns:prism="http://prismlibrary.com/"
- prism:ViewModelLocator.AutoWireViewModel="True"
- xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
- mc:Ignorable="d"
- FontFamily="微软雅黑"
- WindowStyle="None"
- Title="RoleLoginView"
- Height="360"
- Width="650"
- d:Background="White">
- <WindowChrome.WindowChrome>
- <WindowChrome GlassFrameThickness="50"
- CaptionHeight="30"
- NonClientFrameEdges="Left,Bottom,Right"
- CornerRadius="20" />
- </WindowChrome.WindowChrome>
- <Window.Resources>
- <Style x:Key="buttonborder"
- TargetType="Border">
- <Setter Property="BorderThickness"
- Value="2" />
- <Setter Property="Background"
- Value="Transparent" />
- <Setter Property="VerticalAlignment"
- Value="Center" />
- <Setter Property="BorderBrush"
- Value="Transparent" />
- <Setter Property="CornerRadius"
- Value="5" />
- <Setter Property="Effect">
- <Setter.Value>
- <DropShadowEffect BlurRadius="10"
- Direction="1"
- ShadowDepth="0.5"
- Color="#2961AC" />
- </Setter.Value>
- </Setter>
- </Style>
- <!--ComboBox-->
- <!--ComBoBox项选中背景色-->
- <SolidColorBrush x:Key="ComboBoxSelectdBackground"
- Color="#ff8c69" />
- <!--ComBoBox项鼠标经过背景色-->
- <SolidColorBrush x:Key="ComboBoxMouseOverBackground"
- Color="#ff3030" />
- <!--ComBoBox项选中前景色-->
- <SolidColorBrush x:Key="ComboBoxSelectedForeground"
- Color="White" />
- <!--ComBoBox项鼠标经过前景色-->
- <SolidColorBrush x:Key="ComboBoxMouseOverForegrond"
- Color="White" />
- <ControlTemplate x:Key="ComboBoxToggleButton"
- TargetType="{x:Type ToggleButton}">
- <Grid Height="25"
- HorizontalAlignment="Stretch">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="30" />
- </Grid.ColumnDefinitions>
- <Border Background="White"
- Grid.ColumnSpan="2"
- Opacity="0" />
- <Path x:Name="Arrow"
- Grid.Column="1"
- Data="M 0 0 6 6 12 0 Z"
- VerticalAlignment="Center"
- HorizontalAlignment="Center"
- Stretch="None"
- Fill="#999" />
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsChecked"
- Value="true">
- <Setter TargetName="Arrow"
- Property="RenderTransform">
- <Setter.Value>
- <RotateTransform CenterX="6"
- CenterY="3"
- Angle="180"></RotateTransform>
- </Setter.Value>
- </Setter>
- <Setter TargetName="Arrow"
- Property="Margin"
- Value="0 0 0 2" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <Style TargetType="{x:Type ComboBox}">
- <Setter Property="ItemContainerStyle">
- <Setter.Value>
- <Style TargetType="ComboBoxItem">
- <Setter Property="Height"
- Value="20" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ComboBoxItem}">
- <Grid Height="{TemplateBinding Height}"
- Width="{TemplateBinding Width}">
- <Border x:Name="_borderbg"
- Background="Transparent" />
- <TextBlock Margin="3 0 3 0"
- VerticalAlignment="Center"
- x:Name="_txt"
- Foreground="#333"
- Text="{Binding Content,RelativeSource={RelativeSource TemplatedParent}}" />
- <Border x:Name="_border"
- Background="White"
- Opacity="0" />
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsSelected"
- Value="true">
- <Setter TargetName="_borderbg"
- Property="Background"
- Value="{StaticResource ComboBoxSelectdBackground}" />
- <Setter TargetName="_txt"
- Property="Foreground"
- Value="{StaticResource ComboBoxSelectedForeground}" />
- </Trigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsSelected"
- Value="false" />
- <Condition Property="IsMouseOver"
- Value="true" />
- </MultiTrigger.Conditions>
- <Setter TargetName="_borderbg"
- Property="Background"
- Value="{StaticResource ComboBoxMouseOverBackground}" />
- <Setter TargetName="_txt"
- Property="Foreground"
- Value="{StaticResource ComboBoxMouseOverForegrond}" />
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ComboBox}">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="0.7*" />
- <ColumnDefinition Width="0.3*"
- MaxWidth="30" />
- </Grid.ColumnDefinitions>
- <Border Grid.Column="0"
- Grid.ColumnSpan="2"
- BorderThickness="1"
- BorderBrush="{TemplateBinding BorderBrush}"
- CornerRadius="1,0,0,1" />
- <ContentPresenter HorizontalAlignment="Left"
- Margin="3,3,0,3"
- x:Name="ContentSite"
- VerticalAlignment="Center"
- Content="{TemplateBinding SelectionBoxItem}"
- ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
- ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
- IsHitTestVisible="False" />
- <!--ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen-->
- <ToggleButton Grid.Column="0"
- Grid.ColumnSpan="2"
- Template="{StaticResource ComboBoxToggleButton}"
- x:Name="ToggleButton"
- Focusable="false"
- IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
- ClickMode="Press" />
- <!--必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它-->
- <TextBox Visibility="Hidden"
- BorderThickness="0"
- Margin="2 0 0 0"
- x:Name="PART_EditableTextBox"
- VerticalAlignment="Center"
- Focusable="True"
- Background="Transparent"
- IsReadOnly="{TemplateBinding IsReadOnly}" />
- <!--Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen-->
- <Popup IsOpen="{TemplateBinding IsDropDownOpen}"
- Placement="Bottom"
- x:Name="Popup"
- Focusable="False"
- AllowsTransparency="True"
- PopupAnimation="Slide">
- <Grid MaxHeight="150"
- MinWidth="{TemplateBinding ActualWidth}"
- x:Name="DropDown"
- SnapsToDevicePixels="True">
- <Border x:Name="DropDownBorder"
- BorderBrush="#e8e8e8"
- BorderThickness="1 0 1 1" />
- <ScrollViewer Margin="1"
- SnapsToDevicePixels="True"
- HorizontalScrollBarVisibility="Auto"
- VerticalScrollBarVisibility="Auto"
- CanContentScroll="True">
- <!--StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True-->
- <StackPanel IsItemsHost="True"
- KeyboardNavigation.DirectionalNavigation="Contained"
- Background="White" />
- </ScrollViewer>
- </Grid>
- </Popup>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsEditable"
- Value="true">
- <Setter TargetName="PART_EditableTextBox"
- Property="Visibility"
- Value="Visible" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Window.Resources>
- <Grid Background="Transparent">
- <Border BorderBrush="AliceBlue"
- BorderThickness="2"
- Margin="10"
- CornerRadius="10">
- <Border.Background>
- <LinearGradientBrush>
- <GradientStop Color="#95DDFD"
- Offset="0" />
- <GradientStop Color="#97B8FF"
- Offset="0.4" />
- <GradientStop Color="#2961AC"
- Offset="0.9" />
- </LinearGradientBrush>
- </Border.Background>
- <Grid Background="White"
- Opacity="0.8">
- <Grid.RowDefinitions>
- <RowDefinition Height="60" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <Grid Grid.Row="0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <StackPanel Orientation="Horizontal"
- Grid.Column="0">
- <Ellipse Fill="#8A2BE1"
- Width="50"
- Height="50"
- Stretch="Fill">
- </Ellipse>
- <TextBlock Text="灯检"
- Foreground="Black"
- FontSize="25"
- Margin="10"
- FontWeight="Bold" />
- </StackPanel>
- <TextBlock Text="Login"
- Grid.Column="0"
- HorizontalAlignment="Left"
- Margin="5"
- VerticalAlignment="Center"
- FontSize="14" />
- <StackPanel Grid.Column="1"
- HorizontalAlignment="Right">
- <Border Style="{StaticResource buttonborder}">
- <Button Content="关闭"
- VerticalAlignment="Top"
- Foreground="Black"
- Padding="5"
- MinWidth="50"
- BorderBrush="Transparent"
- FontSize="15"
- Click="Button_Click"
- WindowChrome.IsHitTestVisibleInChrome="True"
- Background="Transparent" />
- </Border>
- </StackPanel>
- </Grid>
- <Grid Grid.Row="1"
- VerticalAlignment="Center"
- HorizontalAlignment="Center">
- <StackPanel>
- <TextBlock Text="登录"
- Foreground="Black"
- FontSize="25"
- FontWeight="Bold" />
- <TextBlock Text="Sign in"
- Foreground="Black"
- FontSize="25"
- Margin="0,0,0,10"
- FontWeight="Bold" />
- <ComboBox x:Name="combox"
- Width="180"
- Height="30"
- SelectedItem="{Binding CurrRole}"
- ItemsSource="{Binding RolesList}" />
- </StackPanel>
- </Grid>
- <Grid Grid.Row="2">
- <StackPanel VerticalAlignment="Bottom"
- HorizontalAlignment="Center">
- <PasswordBox x:Name="PasswordBox"
- Margin="5,20,5,5"
- Width="180"
- Height="30"
- VerticalContentAlignment="Bottom"
- FontSize="20"
- FontWeight="Thin">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="PasswordChanged">
- <i:InvokeCommandAction Command="{Binding PasswordChangedCommand}"
- CommandParameter="{Binding ElementName=PasswordBox}" />
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </PasswordBox>
- </StackPanel>
- </Grid>
- <Grid Grid.Row="3">
- <StackPanel HorizontalAlignment="Stretch"
- VerticalAlignment="Center"
- Width="180">
- <TextBlock TextAlignment="Center"
- Background="{ Binding L_Brush}"
- Text="{Binding Loginstr}"
- FontSize="12"
- FontWeight="Bold"
- FontFamily="微软雅黑"
- Margin="50,0,50,10" />
- <Border Background="#0A85D9"
- BorderBrush="Black"
- BorderThickness="1"
- CornerRadius="8">
- <Button Content="登录"
- Name="loginbtu"
- Background="Transparent"
- FontSize="20"
- Foreground="White"
- Margin="5"
- BorderThickness="0"
- Command="{Binding LogoutCommand}"
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" />
- </Border>
- </StackPanel>
- </Grid>
- </Grid>
- </Border>
- </Grid>
- </Window>
|