ソースを参照

搜索-多选搜索结果

zhuyi 2 年 前
コミット
478183e154

+ 15 - 6
PDF Office/ViewModels/BOTA/SearchContentViewModel.cs

@@ -267,15 +267,24 @@ namespace PDF_Master.ViewModels.BOTA
 
             if (PDFViewer != null && textSearch != null)
             {
-                SearchItem currentItem = obj as SearchItem;
+                System.Collections.IList currentItem = obj as System.Collections.IList;
                 if (currentItem != null && PDFViewer != null)
                 {
                     List<TextSearchItem> pageTextList = new List<TextSearchItem>();
-                    currentItem.TextProperty.SearchItem.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x17, 0x70, 0xF4));
-                    currentItem.TextProperty.SearchItem.Padding = new Thickness(3);
-                    currentItem.TextProperty.SearchItem.BorderThickness = 1;
-                    pageTextList.Add(currentItem.TextProperty.SearchItem);
-                    PDFViewer.HighLightSearchText(pageTextList);
+                    for (int i = 0; i < currentItem.Count; i++)
+                    {
+                        if (currentItem[i] is SearchItem)
+                        {
+                            (currentItem[i] as SearchItem).TextProperty.SearchItem.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x17, 0x70, 0xF4));
+                            (currentItem[i] as SearchItem).TextProperty.SearchItem.Padding = new Thickness(3);
+                            (currentItem[i] as SearchItem).TextProperty.SearchItem.BorderThickness = 1;
+                            pageTextList.Add((currentItem[i] as SearchItem).TextProperty.SearchItem);
+                        }
+                    }
+                    if (currentItem.Count>0)
+                    {
+                        PDFViewer.HighLightSearchText(pageTextList);
+                    }
                 }
             }
         }

+ 1 - 1
PDF Office/Views/BOTA/SearchContent.xaml

@@ -496,7 +496,7 @@
 
                 <i:Interaction.Triggers>
                     <i:EventTrigger EventName="SelectionChanged">
-                        <i:InvokeCommandAction Command="{Binding SearchChangedCommand}" CommandParameter="{Binding ElementName=SearchResultList, Path=SelectedItem}" />
+                        <i:InvokeCommandAction Command="{Binding SearchChangedCommand}" CommandParameter="{Binding ElementName=SearchResultList, Path=SelectedItems}" />
                     </i:EventTrigger>
                 </i:Interaction.Triggers>
             </ListView>