CheckPasswordDialog.xaml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <UserControl x:Class="PDF_Master.Views.Dialog.ToolsDialogs.SaftyDialogs.CheckPasswordDialog"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:prism="http://prismlibrary.com/" xmlns:cus="clr-namespace:PDF_Master.CustomControl"
  5. prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
  6. xmlns:help="clr-namespace:PDF_Master.Helper" xmlns:saftydialogs="clr-namespace:PDF_Master.ViewModels.Dialog.ToolsDialogs.SaftyDialogs" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. prism:ViewModelLocator.AutoWireViewModel="True">
  8. <UserControl.Resources>
  9. <Style TargetType="PasswordBox" x:Key="CheckPasswordBoxStyle">
  10. <Setter Property="Height" Value="32"/>
  11. <Setter Property="FontSize" Value="14"/>
  12. <Setter Property="Template">
  13. <Setter.Value>
  14. <ControlTemplate TargetType="PasswordBox">
  15. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}"
  16. BorderThickness="{TemplateBinding BorderThickness}"
  17. Background="{TemplateBinding Background}"
  18. SnapsToDevicePixels="True"
  19. CornerRadius="5">
  20. <Grid>
  21. <Grid.ColumnDefinitions>
  22. <ColumnDefinition></ColumnDefinition>
  23. <ColumnDefinition Width="24"></ColumnDefinition>
  24. </Grid.ColumnDefinitions>
  25. <Grid Grid.Column="0" Margin="8,0,0,0">
  26. <TextBlock Text="{TemplateBinding help:PasswordBoxHelper.DisplayText}" Grid.Column="1" VerticalAlignment="Center" Foreground="#BBB"
  27. Name="markText" Visibility="Collapsed" FontSize="12" />
  28. <ScrollViewer x:Name="PART_ContentHost" Focusable="false"
  29. HorizontalScrollBarVisibility="Hidden"
  30. VerticalScrollBarVisibility="Hidden"
  31. VerticalAlignment="Center" MinHeight="20"/>
  32. </Grid>
  33. </Grid>
  34. </Border>
  35. <ControlTemplate.Triggers>
  36. <Trigger Property="IsEnabled" Value="false">
  37. <Setter Property="Opacity" TargetName="border" Value="0.56"/>
  38. </Trigger>
  39. <Trigger Property="IsMouseOver" Value="true">
  40. <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
  41. </Trigger>
  42. <Trigger Property="IsKeyboardFocused" Value="true">
  43. <Setter Property="BorderBrush" TargetName="border" Value="#1770F4"/>
  44. </Trigger>
  45. <DataTrigger Binding="{Binding Path = Password}" Value="">
  46. <Setter Property="Visibility" TargetName="markText" Value="Visible"/>
  47. </DataTrigger>
  48. <DataTrigger Binding="{Binding Path=IsRightValue}" Value="false">
  49. <Setter Property="BorderBrush" TargetName="border" Value="#F3465B"/>
  50. </DataTrigger>
  51. </ControlTemplate.Triggers>
  52. </ControlTemplate>
  53. </Setter.Value>
  54. </Setter>
  55. </Style>
  56. <Style TargetType="Button" x:Key="DeletePasswordButtonStyle">
  57. <Setter Property="Height" Value="14"></Setter>
  58. <Setter Property="Width" Value="14"></Setter>
  59. <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
  60. <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
  61. <Setter Property="Template">
  62. <Setter.Value>
  63. <ControlTemplate TargetType="{x:Type ButtonBase}">
  64. <Grid>
  65. <Viewbox Stretch="Uniform">
  66. <Grid>
  67. <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"></Path>
  68. </Grid>
  69. </Viewbox>
  70. </Grid>
  71. </ControlTemplate>
  72. </Setter.Value>
  73. </Setter>
  74. </Style>
  75. </UserControl.Resources>
  76. <cus:DialogContent Header="Open Pasword" FontFamily="Segoe UI">
  77. <cus:DialogContent.Content>
  78. <Grid Margin="16,0,16,0" Width="400" MinHeight="106">
  79. <Grid.ColumnDefinitions>
  80. <ColumnDefinition Width="80"></ColumnDefinition>
  81. <ColumnDefinition></ColumnDefinition>
  82. </Grid.ColumnDefinitions>
  83. <Image Source="pack://application:,,,/Resources/Dialog/password.png" Margin="0,-20,0,0"></Image>
  84. <Grid Grid.Column="1" Margin="8,0,0,0">
  85. <Grid.RowDefinitions>
  86. <RowDefinition MinHeight="44"></RowDefinition>
  87. <RowDefinition Height="40"></RowDefinition>
  88. <RowDefinition></RowDefinition>
  89. </Grid.RowDefinitions>
  90. <Grid Grid.Row="0">
  91. <TextBlock TextWrapping="Wrap" Block.TextAlignment="Left" Text="{Binding InputPasswordMsg, Mode=TwoWay}" FontSize="14" FontFamily="Segoe UI"> </TextBlock>
  92. </Grid>
  93. <Grid Grid.Row="1" Margin="0,8,0,0">
  94. <Grid.ColumnDefinitions>
  95. <ColumnDefinition></ColumnDefinition>
  96. <ColumnDefinition Width="23"></ColumnDefinition>
  97. </Grid.ColumnDefinitions>
  98. <PasswordBox PasswordChar="*" Style="{StaticResource CheckPasswordBoxStyle}" help:PasswordBoxHelper.Password="{Binding Password, Mode=TwoWay , UpdateSourceTrigger=PropertyChanged}" help:PasswordBoxHelper.DisplayText="{Binding CheckPasswordMsg, Mode=TwoWay}" help:PasswordBoxHelper.IsRightValue="{Binding IsRightValue, Mode=TwoWay}" Grid.ColumnSpan="2"></PasswordBox>
  99. <Button Style="{StaticResource DeletePasswordButtonStyle}" Grid.Column="1" HorizontalAlignment="Left" Command="{Binding ClearPasswordCommand}" Visibility="{Binding ClearPasswordButtonVisibility, Mode=TwoWay}"></Button>
  100. </Grid>
  101. <Grid Grid.Row="2" Margin="0,2,0,0">
  102. <TextBlock Text="{Binding ErrorPasswordMsg, Mode=TwoWay}" Foreground="#F3465B" Visibility="{Binding ErrorPasswordMsgVisibility, Mode=TwoWay}"></TextBlock>
  103. </Grid>
  104. </Grid>
  105. </Grid>
  106. </cus:DialogContent.Content>
  107. <cus:DialogContent.BottmBar>
  108. <Grid Margin="16">
  109. <StackPanel VerticalAlignment="Center" Height="32" Orientation="Horizontal" HorizontalAlignment="Right">
  110. <Button Width="67" Margin="0,0,16,0" Style="{StaticResource Btn.cta}" Command="{Binding ConfirmCommand}">
  111. <TextBlock Text="Open"></TextBlock>
  112. </Button>
  113. <Button Width="67" Style="{StaticResource btn.ghost}" Command="{Binding CancelCommand}">
  114. <TextBlock Text="Cancel"></TextBlock>
  115. </Button>
  116. </StackPanel>
  117. </Grid>
  118. </cus:DialogContent.BottmBar>
  119. </cus:DialogContent>
  120. </UserControl>