123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746 |
- using PDF_Master.CustomControl;
- using PDF_Master.Helper;
- using PDF_Master.Model.PDFTool;
- using PDF_Master.ViewModels.HomePanel;
- using PDF_Master.ViewModels.HomePanel.PDFTools;
- using PDFSettings;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- 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.Animation;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace PDF_Master.Views.HomePanel.PDFTools
- {
-
- /// <summary>
- /// ToolbarPage.xaml 的交互逻辑
- /// </summary>
- public partial class PDFToolsContent : UserControl
- {
- private PDFToolsContentViewModel ViewModel => DataContext as PDFToolsContentViewModel;
- private ListItemQuickTool sourceListItem = null;
- private ListItemQuickTool targetListItem = null;
- private ListItemQuickTool quickSourceListItem = null;
- private List<ToolItem> quickTools = null;
- private List<ToolItem> allTools = null;
- private List<ToolItem> moreTools = null;
- PDFToolsHelper PDFtools;
- private string fileName = string.Empty;
- private BitmapSource bitmapSource = null;
- private bool isMoreCuts = false;
- private bool isMove = false;
- private Point wrpnlPoint;
- private Point mousePoint;
- public PDFToolsContent()
- {
- InitializeComponent();
- PDFtools = PDFToolsHelper.GetInstance();
- #region ListBox
- SetListBox();
- #endregion ListBox
- }
- //用来测试的,PDF工具还在优化中
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- var PDFtools = Helper.PDFToolsHelper.GetInstance();
- PDFtools.ClearData();
- SetListBox();
- ListShortCutsExpend.Items.Refresh();
- ListMoreCutsExpend.Items.Refresh();
- ListBoxCutsWidthChanged(ListShortCutsExpend);
- ListBoxCutsWidthChanged(ListMoreCutsExpend);
- ListShortCuts.Items.Refresh();
- ListMoreCuts.Items.Refresh();
- ListBoxCutsWidthChanged(ListShortCuts);
- ListBoxCutsWidthChanged(ListMoreCuts);
- }
- /// <summary>
- /// 获取与窗口相对的鼠标位置。
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void OnRendering(object sender, EventArgs e)
- {
- mousePoint = Mouse.GetPosition(this);
- Console.WriteLine($"鼠标坐标:{mousePoint.X}:{mousePoint.Y}");
- }
- private void SetListBox()
- {
- quickTools = PDFtools.QuickTools;
- allTools = PDFtools.AllTools;
- moreTools = PDFtools.MoreTools;
- ListShortCutsExpend.ItemsSource = ListShortCuts.ItemsSource = quickTools;
- ListMoreCutsExpend.ItemsSource = ListMoreCuts.ItemsSource = moreTools;
- }
- private void Page_Loaded(object sender, RoutedEventArgs e)
- {
- UpdateExptend();
- if (ViewModel != null)
- {
- ViewModel.ExpendToolsHanlder -= ViewModel_ExpendToolsHanlder;
- ViewModel.ExpendToolsHanlder += ViewModel_ExpendToolsHanlder;
- }
- }
- private void ViewModel_ExpendToolsHanlder(object sender, bool e)
- {
- if(e)
- {
- ListShortCutsExpend.Items.Refresh();
- ListMoreCutsExpend.Items.Refresh();
- ListBoxCutsWidthChanged(ListShortCutsExpend);
- ListBoxCutsWidthChanged(ListMoreCutsExpend);
- }
- else
- {
- ListShortCuts.Items.Refresh();
- ListMoreCuts.Items.Refresh();
- ListBoxCutsWidthChanged(ListShortCuts);
- ListBoxCutsWidthChanged(ListMoreCuts);
- }
- }
- private ListBoxEx GetListShortControl()
- {
- ListBoxEx ShortEx = null;
- if (ListShortCuts.Visibility == Visibility.Visible)
- {
- ShortEx = ListShortCuts;
- }
- else
- {
- ShortEx = ListShortCutsExpend;
- }
- return ShortEx;
- }
- private ListBoxEx GetListMoreControl()
- {
- ListBoxEx MoreEx = null;
- if (ListMoreCuts.Visibility == Visibility.Visible)
- {
- MoreEx = ListMoreCuts;
- }
- else
- {
- MoreEx = ListMoreCutsExpend;
- }
- return MoreEx;
- }
- private void ListBoxMoreCuts_PreviewMouseMove(object sender, MouseEventArgs e)
- {
- ListBoxEx MoreEx = GetListMoreControl();
- if (MoreEx == null) return;
- var pos = e.GetPosition(MoreEx);
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- MoreEx.AllowDrop = true;
- HitTestResult result = VisualTreeHelper.HitTest(MoreEx, pos);
- if (result == null)
- {
- sourceImage.Visibility = Visibility.Hidden;
- return;
- }
- sourceListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
- if (sourceListItem == null || sourceListItem.Content != MoreEx.SelectedItem)
- {
- return;
- }
- //获取控件相对于另一控件的坐标
- wrpnlPoint = sourceListItem.TranslatePoint(new Point(), this);
- System.Windows.DataObject dataObj = new System.Windows.DataObject(sourceListItem.Content as ToolItem);
- if (dataObj != null)
- {
- //控件截图
- IsMoreToolbars();
- if (string.IsNullOrEmpty(fileName))
- {
- sourceImage.Visibility = Visibility.Hidden;
- return;
- }
- //图片解码
- ImageDecoding();
- isMoreCuts = true;
- DragDrop.DoDragDrop(MoreEx, dataObj, System.Windows.DragDropEffects.Move);
- }
- }
- else
- {
- moveImage.Visibility = Visibility.Hidden;
- sourceImage.Visibility = Visibility.Hidden;
- }
- }
- private void ImageDecoding()
- {
- Stream imageStreamSource = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
- PngBitmapDecoder decoder = new PngBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
- bitmapSource = decoder.Frames[0];
- }
- private void IsMoreToolbars()
- {
- var source = sourceListItem.Content as ToolItem;
- if (moreTools == null && moreTools.Count != 0) return;
- List<ToolItem> toolModule = moreTools.FindAll(item => item.FnName == source.FnName);
- if (toolModule.Count > 0)
- {
- // 判断文件夹是否存在,不存在则创建
- DirectoryInfo folder = new DirectoryInfo(System.IO.Path.Combine(System.IO.Path.GetTempPath(), "Asource"));
- if (!folder.Exists)
- {
- folder.Create();
- }
- fileName = System.IO.Path.Combine(folder.FullName, $"{source.FnName}.png");
- SaveToPng(sourceListItem, fileName);
- }
- }
- private void ListBoxShortCuts_Drop(object sender, DragEventArgs e)
- {
- ListBoxEx ShortEx = GetListShortControl();
- if(ShortEx == null) return;
- var pos = e.GetPosition(ShortEx);
- var result = VisualTreeHelper.HitTest(ShortEx, pos);
- if (result == null)
- {
- WorkingWithAnimation(pos);
- return;
- }
- //查找目标数据
- targetListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
- if (targetListItem == null)
- {
- WorkingWithAnimation(pos);
- return;
- }
- var targetAToolModule = targetListItem.Content as ToolItem;
- ToolItem target = quickTools.Find(c => c.FnName == targetAToolModule.FnName);
- //查找元数据
- var sourceAToolModule = e.Data.GetData(typeof(ToolItem)) as ToolItem;
- if (sourceAToolModule == null)
- {
- sourceImage.Visibility = Visibility.Hidden;
- // target.SetValue(AToolModule.IsFilePickedProperty, false);
- return;
- }
- if (ReferenceEquals(targetAToolModule, sourceAToolModule))
- {
- sourceImage.Visibility = Visibility.Hidden;
- // target.SetValue(AToolModule.IsFilePickedProperty, false);
- return;
- }
- if (targetAToolModule == null && sourceAToolModule == null)
- {
- sourceImage.Visibility = Visibility.Hidden;
- // target.SetValue(AToolModule.IsFilePickedProperty, false);
- return;
- }
- ModuleExchange(sourceAToolModule, targetAToolModule);
- }
- private void ModuleExchange(ToolItem sourceAToolModule, ToolItem targetAToolModule)
- {
- if (moreTools == null) return;
- ToolItem source = moreTools.Find(c => c.FnName == sourceAToolModule.FnName);
- ListBoxEx MoreEx = GetListMoreControl();
- if (MoreEx == null) return;
- ListBoxEx ShortEx = GetListShortControl();
- if (ShortEx == null) return;
- int targetIndex = quickTools.FindIndex(item => item.FnName == targetAToolModule.FnName);
- if (targetIndex < 0) return;
- if (!isMoreCuts)
- {
- MoreEx.AllowDrop = false;
- sourceImage.Visibility = Visibility.Hidden;
- source = quickTools.Find(c => c.FnName == sourceAToolModule.FnName);
- if (source == null) return;
- int sourceIndex = quickTools.FindIndex(item => item.FnName == sourceAToolModule.FnName);
- if (sourceIndex < 0) return;
- var temp = quickTools[sourceIndex];
- quickTools[sourceIndex] = quickTools[targetIndex];
- quickTools[targetIndex] = temp;
- var sourceId = source.ToolTypeId;
- var targetId = target.ToolTypeId;
- source.ToolTypeId = targetId;
- target.ToolTypeId = sourceId;
- source.IsQuickTool = true;
- target.IsQuickTool = true;
- ShortEx.Items.Refresh();
- ListBoxCutsWidthChanged(ShortEx);
- }
- else
- {
- if (target == null) return;
- if (source == null) return;
- moreTools.Remove(source);
- moreTools.Insert(0, target);
- quickTools.Remove(target);
- quickTools.Insert(targetIndex, source);
- source.IsQuickTool = true;
- target.IsQuickTool = false;
- var targetId = target.ToolTypeId;
- source.ToolTypeId = targetId;
- target.ToolTypeId = 0;//移到第一个位置
- MoreEx.Items.Refresh();
- ShortEx.Items.Refresh();
- sourceImage.Visibility = Visibility.Hidden;
- targetListItem.IsOverModular = false;
- ListBoxCutsWidthChanged(ShortEx);
- ListBoxCutsWidthChanged(MoreEx);
- }
- if (PDFtools != null)
- PDFtools.SaveCacheList();
- }
- private void WorkingWithAnimation(Point pos)
- {
- sourceImage.Visibility = Visibility.Hidden;
- if (!isMoreCuts || !isMove)
- {
- moveImage.Visibility = Visibility.Hidden;
- }
- else
- {
- if (sourceListItem == null) return;
- moveImage.Visibility = Visibility.Visible;
- Point point = sourceListItem.TransformToAncestor(this).Transform(new Point(0, 0));
- ImageMoveTo(new Point(pos.X - 80, pos.Y), new Point(wrpnlPoint.X + 40, wrpnlPoint.Y), moveImage, 200);
- }
- }
- /// <summary>
- /// 图片移动动画
- /// </summary>
- /// <param name="curPoint">初始位置</param>
- /// <param name="deskPoint">控件要移动到的位置</param>
- /// <param name="ell">你要移动的空间</param>
- /// <param name="space">设置移动的时间片(关系到控件移动的速度)</param>
- private void ImageMoveTo(Point curPoint, Point deskPoint, Image ell, double space)
- {
- Storyboard storyboard = new Storyboard(); //创建Storyboard对象
- double lxspeed = space, lyspeed = space; //设置X方向 / Y方向 移动时间片
- //创建X轴方向动画
- DoubleAnimation dox = new DoubleAnimation(
- curPoint.X,
- deskPoint.X,
- new Duration(TimeSpan.FromMilliseconds(lxspeed))
- );
- //创建Y轴方向动画
- DoubleAnimation doy = new DoubleAnimation(
- curPoint.Y,
- deskPoint.Y,
- new Duration(TimeSpan.FromMilliseconds(lyspeed))
- );
- Storyboard.SetTarget(dox, ell);
- Storyboard.SetTarget(doy, ell);
- Storyboard.SetTargetProperty(dox, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.X)"));
- Storyboard.SetTargetProperty(doy, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)"));
- storyboard.Children.Add(dox);
- storyboard.Children.Add(doy);
- storyboard.Completed += Storyboard_Completed;
- //动画播放
- storyboard.Begin();
- }
- private void Storyboard_Completed(object sender, EventArgs e)
- {
- moveImage.Visibility = Visibility.Hidden;
- }
- /// <summary>
- /// 控件截图
- /// </summary>
- /// <param name="visual">控件</param>
- /// <param name="fileName">文件路径 C:\Users\oyxh\AppData\Local\Temp\</param>
- private void SaveToPng(FrameworkElement visual, string fileName)
- {
- DrawingVisual drawingVisual = new DrawingVisual();
- using (DrawingContext context = drawingVisual.RenderOpen())
- {
- VisualBrush brush = new VisualBrush(sourceListItem) { Stretch = Stretch.None };
- context.DrawRectangle(brush, null, new Rect(0, 0, sourceListItem.ActualWidth, sourceListItem.ActualHeight));
- context.Close();
- }
- RenderTargetBitmap targetBitmap = new RenderTargetBitmap((int)sourceListItem.ActualWidth, (int)sourceListItem.ActualHeight, 96d, 96d, PixelFormats.Default);
- targetBitmap.Render(drawingVisual);
- FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
- PngBitmapEncoder encoder = new PngBitmapEncoder();
- encoder.Interlace = PngInterlaceOption.On;
- encoder.Frames.Add(BitmapFrame.Create(targetBitmap));
- encoder.Save(stream);
- stream.Close();
- }
- private ToolItem target;
- private void ListBoxShortCuts_DragOver(object sender, DragEventArgs e)
- {
- ListBoxEx MoreEx = GetListMoreControl();
- if (MoreEx == null) return;
- ListBoxEx ShortEx = GetListShortControl();
- if (ShortEx == null) return;
- var pos = e.GetPosition(ShortEx);
- Console.WriteLine($"pos:{pos.X} {pos.Y} this.Grid.ActualHeight1 {this.Grid.ActualHeight}");
- if (pos.Y < 0)
- {
- isMove = false;
- sourceImage.Visibility = Visibility.Hidden;
- sourceListItem = null;
- return;
- }
- if (pos.Y >= this.Grid.ActualHeight - 50)
- {
- isMove = false;
- sourceImage.Visibility = Visibility.Hidden;
- sourceListItem = null;
- return;
- }
- if (pos.X < 10)
- {
- isMove = false;
- sourceListItem = null;
- sourceImage.Visibility = Visibility.Hidden;
- return;
- }
- if (pos.X >= this.Grid.ActualWidth - 10)
- {
- isMove = false;
- sourceListItem = null;
- sourceImage.Visibility = Visibility.Hidden;
- return;
- }
- if (!isMoreCuts)
- {
- var sourceAToolModule = e.Data.GetData(typeof(ToolItem)) as ToolItem;
- if (sourceAToolModule == null) return;
- int sourceIndex = quickTools.FindIndex(item => item.FnName == sourceAToolModule.FnName);
- //根据index找listbox对应的item
- sourceListItem = (ListItemQuickTool)(ShortEx.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
- if (sourceListItem == null)
- {
- return;
- }
- MoreEx.AllowDrop = false;
- sourceImage.Visibility = Visibility.Hidden;
- }
- else
- {
- var sourceAToolModule = e.Data.GetData(typeof(ToolItem)) as ToolItem;
- if (sourceAToolModule == null) return;
- int sourceIndex = moreTools.FindIndex(item => item.FnName == sourceAToolModule.FnName);
- //根据index找listbox对应的item
- sourceListItem = (ListItemQuickTool)(MoreEx.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
- if (sourceListItem == null)
- {
- return;
- }
- isMove = true;
- //图片绑定
- ImageBinding(pos);
- }
- var result = VisualTreeHelper.HitTest(ShortEx, pos);
- if (result == null)
- {
- return;
- }
- //查找目标数据
- targetListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
- if (targetListItem == null)
- {
- //sourceImage.Visibility = Visibility.Hidden;
- return;
- }
- var targetAToolModule = targetListItem.Content as ToolItem;
- if (targetAToolModule == null) return;
- target = quickTools.Find(c => c.FnName == targetAToolModule.FnName);
- }
- /// <summary>
- ///图片绑定
- /// </summary>
- private void ImageBinding(System.Windows.Point pos)
- {
- sourceImage.Visibility = Visibility.Visible;
- sourceImage.Source = bitmapSource;
- sourceImage.Margin = new Thickness(pos.X - 80, pos.Y, 0, 0);
- moveImage.Source = sourceImage.Source;
- }
- private void ListBoxShortCuts_PreviewMouseMove(object sender, MouseEventArgs e)
- {
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- ListBoxEx MoreEx = GetListMoreControl();
- if (MoreEx == null) return;
- ListBoxEx ShortEx = GetListShortControl();
- if (ShortEx == null) return;
- MoreEx.AllowDrop = false;
- var pos = e.GetPosition(ShortEx);
- HitTestResult result = VisualTreeHelper.HitTest(ShortEx, pos);
- if (result == null)
- {
- return;
- }
- quickSourceListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
- if (quickSourceListItem == null || quickSourceListItem.Content != ShortEx.SelectedItem)
- {
- return;
- }
- System.Windows.DataObject dataObj = new System.Windows.DataObject(quickSourceListItem.Content as ToolItem);
- if (dataObj != null)
- {
- isMoreCuts = false;
- DragDrop.DoDragDrop(ShortEx, dataObj, System.Windows.DragDropEffects.Move);
- }
- }
- else
- {
- sourceImage.Visibility = Visibility.Hidden;
- //moveImage.Visibility = Visibility.Hidden;
- }
- }
- private void sourceImage_Drop(object sender, DragEventArgs e)
- {
- ListBoxShortCuts_Drop(sender, e);
- }
- private void sourceImage_PreviewMouseMove(object sender, MouseEventArgs e)
- {
- ListBoxMoreCuts_PreviewMouseMove(sender, e);
- }
- private void sourceImage_DragOver(object sender, DragEventArgs e)
- {
- ListBoxShortCuts_DragOver(sender, e);
- }
- private void Label_PreviewMouseMove(object sender, MouseEventArgs e)
- {
- ListBoxMoreCuts_PreviewMouseMove(sender, e);
- }
- private void ListBoxMoreCuts_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- //获取当前控件元素相对鼠标点击的位置(只有点击在当前A控件,会触发事件并返回相对A控件的鼠标位置)。
- Point pp = Mouse.GetPosition(e.Source as FrameworkElement);//WPF方法
- sourceImage.Visibility = Visibility.Hidden;
- if (pp.X < 0 || pp.Y < 0)
- {
- moveImage.Visibility = Visibility.Hidden;
- }
- }
- private void ListBoxShortCuts_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- ListBoxEx ShortEx = GetListShortControl();
- if (ShortEx == null) return;
- ListBoxCutsWidthChanged(ShortEx);
- }
- private void ListBoxMoreCuts_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- ListBoxEx MoreEx = GetListMoreControl();
- if (MoreEx == null) return;
- ListBoxCutsWidthChanged(MoreEx);
- }
- private void ListBoxCutsWidthChanged(ListBoxEx list)
- {
- if (list == null) return;
- //3x + 4y = containerWidth;
- //3x = y;
- //x为间距,y为item;
- double containerWidth = list.ActualWidth - 20;
- int widthItem = (int)containerWidth / 5;
- double margin = widthItem / 3;
- int i = 0;
- foreach (var item in list.Items)
- {
- i++;
- var listBoxItem = list.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
- if (listBoxItem != null)
- {
- if (i % 4 != 0)
- {
- listBoxItem.Margin = new Thickness(0, 0, margin, 0);
- }
- else
- {
- listBoxItem.Margin = new Thickness(0, 0, 0, 0);
- }
- listBoxItem.Width = widthItem;
- }
- }
- }
- private void BtnTools_Click(object sender, RoutedEventArgs e)
- {
-
- }
- private void BtnExptend_Click(object sender, RoutedEventArgs e)
- {
- UpdateExptend();
- }
- private void UpdateExptend()
- {
- //foreach (var item in allTools)
- //{
- // item.IsShowConciseContent = !(bool)BtnExptend.IsChecked;
- //}
- //foreach (var item in quickTools)
- //{
- // item.IsShowConciseContent = !(bool)BtnExptend.IsChecked;
- //}
- }
- //自适应流式布局,以防改需求备用
- //private void ListBoxMoreCutsWidthChanged()
- //{
- // double containerWidth = ListBoxShortCuts.ActualWidth;
- // int Rowcount = (int)containerWidth / 240;
- // double EndRow = containerWidth % 240.0;
- // Rowcount = EndRow >= 140 ? ++Rowcount : Rowcount;
- // int i = 0;
- // foreach (var item in ListBoxMoreCuts.Items)
- // {
- // i++;
- // var listBoxItem = ListBoxMoreCuts.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
- // if (listBoxItem != null)
- // {
- // if (i % Rowcount != 0)
- // {
- // listBoxItem.Margin = new Thickness(0, 0, 100, 0);
- // }
- // else
- // {
- // listBoxItem.Margin = new Thickness(0, 0, 0, 0);
- // }
- // }
- // }
- //}
- ///// <summary>
- ///// 扩展收缩UI
- ///// </summary>
- ///// <param name="IsShowConciseContent">是否收缩</param>
- //private void ShowToolsUI(ListBoxEx list,bool IsShowConciseContent)
- //{
- // foreach (var item in list.Items)
- // {
- // var listBoxItem = list.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
- // if (listBoxItem != null)
- // {
- // var viewItem = listBoxItem.ContentTemplate;
- // var myContentPresenter = CommonHelper.FindVisualChild<ContentPresenter>(listBoxItem);
- // var obj = viewItem.FindName("data", myContentPresenter);
- // var checkNum = obj as PDFToolItem;
- // if (checkNum != null)
- // {
- // checkNum.IsShowConciseContent = IsShowConciseContent;
- // }
- // }
- // }
- //}
- }
- }
|