123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using PDF_Office.CustomControl;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace PDF_Office.Views.BOTA
- {
- public class TextSearchBindItem : INotifyPropertyChanged
- {
- public int ShowPageIndex { get { return BindProperty.PageIndex + 1; } set { BindProperty.PageIndex = value; } }
- public TextBindProperty BindProperty { get; set; }
- public TextSearchBindItem()
- {
- BindProperty = new TextBindProperty();
- }
- public int PageCount { get; set; }
- private int _pageMaxCount;
- public int PageMaxCount { get { return _pageMaxCount; } set { _pageMaxCount = value; OnPropertyChanged("Percent"); } }
- public double Percent { get { if (PageMaxCount > 0 && PageCount >= 0) return (double)PageCount / (double)PageMaxCount; return 0; } }
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged([CallerMemberName] string name = null)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
- }
- }
- public class TextBindProperty
- {
- public int PageIndex { get; set; }
- public string TextContent { get; set; }
- public Color HighLightColor { get; set; }
- public string SearchWord { get; set; }
- public Rect TextRect { get; set; }
- public int PageRotate { get; set; }
- }
- /// <summary>
- /// SearchContent.xaml 的交互逻辑
- /// </summary>
- public partial class SearchContent : UserControl
- {
- // private ObservableCollection<TextSearchBindItem> searchResults;
- public SearchContent()
- {
- InitializeComponent();
- // searchResults = new ObservableCollection<TextSearchBindItem>();
- // ICollectionView groupView = CollectionViewSource.GetDefaultView(searchResults);
- // groupView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(TextSearchBindItem.ShowPageIndex)));
- }
- private void SearchResultList_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- }
- private void BtnExptend_Click(object sender, RoutedEventArgs e)
- {
- var btn = sender as CustomIconToggleBtn;
- if (btn == null) return;
- var item = (sender as FrameworkElement).DataContext as CollectionViewGroup;
- if(item != null)
- {
- foreach (var item2 in item.Items)
- {
- var item3 = item2 as TextSearchBindItem;
- var listBoxItem = SearchResultList.ItemContainerGenerator.ContainerFromItem(item3) as ListViewItem;
- if (listBoxItem != null)
- {
- if(btn.IsChecked == true)
- {
- listBoxItem.Visibility = Visibility.Collapsed;
- }
- else
- {
- listBoxItem.Visibility = Visibility.Visible;
- }
- }
- }
- }
- }
- }
- }
|