123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <UserControl
- x:Class="PDF_Master.Views.Dialog.ToolsDialogs.SaftyDialogs.CheckPasswordDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:cus="clr-namespace:PDF_Master.CustomControl"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:help="clr-namespace:PDF_Master.Helper"
- xmlns:prism="http://prismlibrary.com/"
- xmlns:saftydialogs="clr-namespace:PDF_Master.ViewModels.Dialog.ToolsDialogs.SaftyDialogs"
- prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
- prism:ViewModelLocator.AutoWireViewModel="True"
- Loaded="UserControl_Loaded">
- <UserControl.Resources>
- <Style x:Key="CheckPasswordBoxStyle" TargetType="PasswordBox">
- <Setter Property="Height" Value="32" />
- <Setter Property="FontSize" Value="14" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="PasswordBox">
- <Border
- x:Name="border"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="5"
- SnapsToDevicePixels="True">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition Width="24" />
- </Grid.ColumnDefinitions>
- <Grid Grid.Column="0" Margin="8,0,0,0">
- <TextBlock
- Name="markText"
- Grid.Column="1"
- VerticalAlignment="Center"
- FontSize="12"
- Foreground="#BBB"
- Text="{TemplateBinding help:PasswordBoxHelper.DisplayText}"
- Visibility="Collapsed" />
- <ScrollViewer
- x:Name="PART_ContentHost"
- MinHeight="20"
- VerticalAlignment="Center"
- Focusable="false"
- HorizontalScrollBarVisibility="Hidden"
- VerticalScrollBarVisibility="Hidden" />
- </Grid>
- </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="#1770F4" />
- </Trigger>
- <DataTrigger Binding="{Binding Path=Password}" Value="">
- <Setter TargetName="markText" Property="Visibility" Value="Visible" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Path=IsRightValue}" Value="false">
- <Setter TargetName="border" Property="BorderBrush" Value="#F3465B" />
- </DataTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="DeletePasswordButtonStyle" TargetType="Button">
- <Setter Property="Height" Value="14" />
- <Setter Property="Width" Value="14" />
- <Setter Property="HorizontalContentAlignment" Value="Center" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ButtonBase}">
- <Grid>
- <Viewbox Stretch="Uniform">
- <Grid Background="Transparent">
- <Path Data="M7 14C10.866 14 14 10.866 14 7C14 3.13401 10.866 0 7 0C3.13401 0 0 3.13401 0 7C0 10.866 3.13401 14 7 14ZM10.5303 4.53038L8.06069 7L10.5303 9.46962L9.46967 10.5303L7.00002 8.06066L4.53033 10.5303L3.46967 9.46967L5.93936 7L3.46967 4.53033L4.53033 3.46967L7.00002 5.93934L9.46967 3.46971L10.5303 4.53038Z" Fill="#CED0D4" />
- </Grid>
- </Viewbox>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </UserControl.Resources>
- <cus:DialogContent FontFamily="Segoe UI" Header="{Binding PasswordDialogTitle}">
- <cus:DialogContent.Content>
- <Grid
- Width="400"
- MinHeight="106"
- Margin="16,0,16,0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="80" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Image Margin="0,-20,0,0" Source="pack://application:,,,/Resources/Dialog/password.png" />
- <Grid Grid.Column="1" Margin="8,0,0,0">
- <Grid.RowDefinitions>
- <RowDefinition MinHeight="44" />
- <RowDefinition Height="40" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <Grid Grid.Row="0">
- <TextBlock
- Block.TextAlignment="Left"
- FontFamily="Segoe UI"
- FontSize="14"
- Text="{Binding InputPasswordMsg, Mode=TwoWay}"
- TextWrapping="Wrap" />
- </Grid>
- <Grid
- Grid.Row="1"
- Margin="0,8,0,0"
- FocusManager.FocusedElement="{Binding ElementName=InputBox}">
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition Width="23" />
- </Grid.ColumnDefinitions>
- <PasswordBox
- Name="InputBox"
- Grid.ColumnSpan="2"
- help:PasswordBoxHelper.DisplayText="{Binding CheckPasswordMsg, Mode=TwoWay}"
- help:PasswordBoxHelper.IsRightValue="{Binding IsRightValue, Mode=TwoWay}"
- help:PasswordBoxHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- Focusable="True"
- PasswordChar="*"
- Style="{StaticResource CheckPasswordBoxStyle}" />
- <Button
- Grid.Column="1"
- HorizontalAlignment="Left"
- Command="{Binding ClearPasswordCommand}"
- Style="{StaticResource DeletePasswordButtonStyle}"
- Visibility="{Binding ClearPasswordButtonVisibility, Mode=TwoWay}" />
- </Grid>
- <Grid Grid.Row="2" Margin="0,2,0,0">
- <TextBlock
- Foreground="#F3465B"
- Text="{Binding ErrorPasswordMsg, Mode=TwoWay}"
- TextWrapping="Wrap"
- Visibility="{Binding ErrorPasswordMsgVisibility, Mode=TwoWay}" />
- </Grid>
- </Grid>
- </Grid>
- </cus:DialogContent.Content>
- <cus:DialogContent.BottmBar>
- <Grid Margin="16">
- <StackPanel
- Height="32"
- HorizontalAlignment="Right"
- VerticalAlignment="Center"
- Orientation="Horizontal">
- <Button
- Width="67"
- Margin="0,0,16,0"
- Command="{Binding ConfirmCommand}"
- IsDefault="True"
- Style="{StaticResource Btn.cta}">
- <TextBlock Text="Open" />
- </Button>
- <Button
- Width="67"
- Command="{Binding CancelCommand}"
- Style="{StaticResource btn.sec}">
- <TextBlock Text="Cancel" />
- </Button>
- </StackPanel>
- </Grid>
- </cus:DialogContent.BottmBar>
- </cus:DialogContent>
- </UserControl>
|