Browse Source

其他-补充提交

ZhouJieSheng 2 years ago
parent
commit
f2e02cec2c

+ 1 - 1
PDF Office/CustomControl/CompositeControl/ColorContent.xaml

@@ -94,7 +94,7 @@
             ItemContainerStyle="{StaticResource listboxItemStyle}"
             ItemTemplate="{StaticResource listboxData}"
             SelectionChanged="ListColor_SelectionChanged"
-            Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorContent}, Path=Visibility}">
+            Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorContent}, Path=ShowColorList}">
             <ListBox.ItemsPanel>
                 <ItemsPanelTemplate>
                     <WrapPanel Orientation="Horizontal" />

+ 35 - 0
PDF Office/DataConvert/ColorBrushConvert.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace PDF_Office.DataConvert
+{
+    /// <summary>
+    /// Color to SolidColorBrush
+    /// </summary>
+    public class ColorBrushConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if((Color)value!=null)
+            {
+                return new SolidColorBrush((Color)value);
+            }
+            return Brushes.White;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+           if((SolidColorBrush)value!=null)
+            {
+                return ((SolidColorBrush)value).Color;
+            }
+            return Brushes.White.Color;
+        }
+    }
+}