Browse Source

compdfkit(win) - 已信任的证书信任按钮失效

weixiangjie 1 year ago
parent
commit
9c7eb3223a

+ 1 - 6
Demo/Examples/Compdfkit_Tools/Common/Convert/ReverseBoolConverter.cs

@@ -10,12 +10,7 @@ namespace Compdfkit_Tools.Common
     {
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
         {
-            if ((bool)value == true)
-            {
-                return false;
-            }
-            else
-                return true;
+            return (bool)value != true;
         }
 
         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

+ 3 - 1
Demo/Examples/Compdfkit_Tools/DigitalSignature/ViewCertificationControl/ConfidenceControl.xaml

@@ -4,6 +4,7 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
+             xmlns:common="clr-namespace:Compdfkit_Tools.Common"
              mc:Ignorable="d" 
              d:DesignHeight="150" d:DesignWidth="600" x:Name="UserControl1">
     
@@ -25,6 +26,7 @@
                 </Canvas>
             </Viewbox>
             <local:ConfidenceStatusToPathConverter x:Key="ConfidenceStatusToPathConverter" />
+            <common:ReverseBoolConverter x:Key="ReverseBoolConverter" />
         </ResourceDictionary>
     </UserControl.Resources>
     
@@ -56,6 +58,6 @@
 
             </StackPanel>
         </Border>
-        <Button Grid.Row="1" Content="Click to add a creditable certificate" Click="ButtonBase_OnClick" Height="32" Width="230" HorizontalAlignment="Right" Margin="0,0,12,12"></Button>
+        <Button Grid.Row="1" Content="Click to add a creditable certificate" IsEnabled="{Binding IsTrusted, Converter={StaticResource ReverseBoolConverter}}" Click="ButtonBase_OnClick" Height="32" Width="230" HorizontalAlignment="Right" Margin="0,0,12,12"></Button>
     </Grid>
 </UserControl>