SearchContent.xaml.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Runtime.CompilerServices;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Navigation;
  17. using System.Windows.Shapes;
  18. namespace PDF_Office.Views.BOTA
  19. {
  20. public class TextSearchBindItem : INotifyPropertyChanged
  21. {
  22. public int ShowPageIndex { get { return BindProperty.PageIndex + 1; } set { BindProperty.PageIndex = value; } }
  23. public TextBindProperty BindProperty { get; set; }
  24. public TextSearchBindItem()
  25. {
  26. BindProperty = new TextBindProperty();
  27. }
  28. public int PageCount { get; set; }
  29. private int _pageMaxCount;
  30. public int PageMaxCount { get { return _pageMaxCount; } set { _pageMaxCount = value; OnPropertyChanged("Percent"); } }
  31. public double Percent { get { if (PageMaxCount > 0 && PageCount >= 0) return (double)PageCount / (double)PageMaxCount; return 0; } }
  32. public event PropertyChangedEventHandler PropertyChanged;
  33. protected void OnPropertyChanged([CallerMemberName] string name = null)
  34. {
  35. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
  36. }
  37. }
  38. public class TextBindProperty
  39. {
  40. public int PageIndex { get; set; }
  41. public string TextContent { get; set; }
  42. public Color HighLightColor { get; set; }
  43. public string SearchWord { get; set; }
  44. public Rect TextRect { get; set; }
  45. public int PageRotate { get; set; }
  46. }
  47. /// <summary>
  48. /// SearchContent.xaml 的交互逻辑
  49. /// </summary>
  50. public partial class SearchContent : UserControl
  51. {
  52. // private ObservableCollection<TextSearchBindItem> searchResults;
  53. public SearchContent()
  54. {
  55. InitializeComponent();
  56. // searchResults = new ObservableCollection<TextSearchBindItem>();
  57. // ICollectionView groupView = CollectionViewSource.GetDefaultView(searchResults);
  58. // groupView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(TextSearchBindItem.ShowPageIndex)));
  59. }
  60. private void SearchResultList_SelectionChanged(object sender, SelectionChangedEventArgs e)
  61. {
  62. }
  63. }
  64. }