PDFToolsContent.xaml.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. using PDF_Office.CustomControl;
  2. using PDF_Office.Helper;
  3. using PDF_Office.Model.PDFTool;
  4. using PDF_Office.ViewModels.HomePanel;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows;
  12. using System.Windows.Controls;
  13. using System.Windows.Data;
  14. using System.Windows.Documents;
  15. using System.Windows.Input;
  16. using System.Windows.Media;
  17. using System.Windows.Media.Animation;
  18. using System.Windows.Media.Imaging;
  19. using System.Windows.Navigation;
  20. using System.Windows.Shapes;
  21. namespace PDF_Office.Views.HomePanel.PDFTools
  22. {
  23. /// <summary>
  24. /// ToolbarPage.xaml 的交互逻辑
  25. /// </summary>
  26. public partial class PDFToolsContent : UserControl
  27. {
  28. private ListItemQuickTool sourceListItem = null;
  29. private ListItemQuickTool targetListItem = null;
  30. private ListItemQuickTool quickSourceListItem = null;
  31. private List<ToolItem> quickTools = null;
  32. private List<ToolItem> allTools = null;
  33. private List<ToolItem> moreTools = null;
  34. private string fileName = string.Empty;
  35. private BitmapSource bitmapSource = null;
  36. private bool isMoreCuts = false;
  37. private bool isMove = false;
  38. private Point wrpnlPoint;
  39. private Point mousePoint;
  40. public PDFToolsContent()
  41. {
  42. InitializeComponent();
  43. quickTools = new List<ToolItem>();
  44. allTools = new List<ToolItem>();
  45. #region ListBox
  46. SetListBox();
  47. #endregion ListBox
  48. }
  49. /// <summary>
  50. /// 获取与窗口相对的鼠标位置。
  51. /// </summary>
  52. /// <param name="sender"></param>
  53. /// <param name="e"></param>
  54. private void OnRendering(object sender, EventArgs e)
  55. {
  56. mousePoint = Mouse.GetPosition(this);
  57. Console.WriteLine($"鼠标坐标:{mousePoint.X}:{mousePoint.Y}");
  58. }
  59. private void SetListBox()
  60. {
  61. string path = @"pack://application:,,,/Resources/PromotionIcon/Windows.png";
  62. List<string> all = new List<string>() { "PDF转Word", "PDF转Excel", "PDF转PPT", "转档PDF", "OCR", "拆分",
  63. "提取","合并","压缩","图片转PDF","安全", "水印", "页眉页脚","贝茨Bates码","批量处理","打印", "背景","插入","文件对比"};
  64. for (int i = 0; i < all.Count; i++)
  65. {
  66. ToolItem aToolModule = new ToolItem();
  67. aToolModule.Id = i + 1;
  68. aToolModule.Name = all[i];
  69. aToolModule.Image = path;
  70. allTools.Add(aToolModule);
  71. }
  72. //取前10个,如果List里面数据少于5个,则返回所有的
  73. quickTools = allTools.Take(8).ToList<ToolItem>();
  74. ListShortCuts.ItemsSource = quickTools;
  75. //对比两个集合,取差值
  76. moreTools = allTools.Except(quickTools).ToList();
  77. ListMoreCuts.ItemsSource = moreTools;
  78. }
  79. private void Page_Loaded(object sender, RoutedEventArgs e)
  80. {
  81. }
  82. private void ListBoxMoreCuts_PreviewMouseMove(object sender, MouseEventArgs e)
  83. {
  84. var pos = e.GetPosition(ListMoreCuts);
  85. if (e.LeftButton == MouseButtonState.Pressed)
  86. {
  87. ListMoreCuts.AllowDrop = true;
  88. HitTestResult result = VisualTreeHelper.HitTest(ListMoreCuts, pos);
  89. if (result == null)
  90. {
  91. sourceImage.Visibility = Visibility.Hidden;
  92. return;
  93. }
  94. sourceListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
  95. if (sourceListItem == null || sourceListItem.Content != ListMoreCuts.SelectedItem)
  96. {
  97. return;
  98. }
  99. //获取控件相对于另一控件的坐标
  100. wrpnlPoint = sourceListItem.TranslatePoint(new Point(), this);
  101. System.Windows.DataObject dataObj = new System.Windows.DataObject(sourceListItem.Content as ToolItem);
  102. if (dataObj != null)
  103. {
  104. //控件截图
  105. IsMoreToolbars();
  106. if (string.IsNullOrEmpty(fileName))
  107. {
  108. sourceImage.Visibility = Visibility.Hidden;
  109. return;
  110. }
  111. //图片解码
  112. ImageDecoding();
  113. isMoreCuts = true;
  114. DragDrop.DoDragDrop(ListMoreCuts, dataObj, System.Windows.DragDropEffects.Move);
  115. }
  116. }
  117. else
  118. {
  119. moveImage.Visibility = Visibility.Hidden;
  120. sourceImage.Visibility = Visibility.Hidden;
  121. }
  122. }
  123. private void ImageDecoding()
  124. {
  125. Stream imageStreamSource = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
  126. PngBitmapDecoder decoder = new PngBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
  127. bitmapSource = decoder.Frames[0];
  128. }
  129. private void IsMoreToolbars()
  130. {
  131. var source = sourceListItem.Content as ToolItem;
  132. if (moreTools == null && moreTools.Count != 0) return;
  133. List<ToolItem> toolModule = moreTools.FindAll(item => item.Name == source.Name);
  134. if (toolModule.Count > 0)
  135. {
  136. // 判断文件夹是否存在,不存在则创建
  137. DirectoryInfo folder = new DirectoryInfo(System.IO.Path.Combine(System.IO.Path.GetTempPath(), "Asource"));
  138. if (!folder.Exists)
  139. {
  140. folder.Create();
  141. }
  142. fileName = System.IO.Path.Combine(folder.FullName, $"{source.Name}.png");
  143. SaveToPng(sourceListItem, fileName);
  144. }
  145. }
  146. private void ListBoxShortCuts_Drop(object sender, DragEventArgs e)
  147. {
  148. var pos = e.GetPosition(ListShortCuts);
  149. var result = VisualTreeHelper.HitTest(ListShortCuts, pos);
  150. if (result == null)
  151. {
  152. WorkingWithAnimation(pos);
  153. return;
  154. }
  155. //查找目标数据
  156. targetListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
  157. if (targetListItem == null)
  158. {
  159. WorkingWithAnimation(pos);
  160. return;
  161. }
  162. var targetAToolModule = targetListItem.Content as ToolItem;
  163. ToolItem target = quickTools.Find(c => c.Name == targetAToolModule.Name);
  164. //查找元数据
  165. var sourceAToolModule = e.Data.GetData(typeof(ToolItem)) as ToolItem;
  166. if (sourceAToolModule == null)
  167. {
  168. sourceImage.Visibility = Visibility.Hidden;
  169. // target.SetValue(AToolModule.IsFilePickedProperty, false);
  170. return;
  171. }
  172. if (ReferenceEquals(targetAToolModule, sourceAToolModule))
  173. {
  174. sourceImage.Visibility = Visibility.Hidden;
  175. // target.SetValue(AToolModule.IsFilePickedProperty, false);
  176. return;
  177. }
  178. if (targetAToolModule == null && sourceAToolModule == null)
  179. {
  180. sourceImage.Visibility = Visibility.Hidden;
  181. // target.SetValue(AToolModule.IsFilePickedProperty, false);
  182. return;
  183. }
  184. ModuleExchange(sourceAToolModule, targetAToolModule);
  185. }
  186. private void ModuleExchange(ToolItem sourceAToolModule, ToolItem targetAToolModule)
  187. {
  188. if (moreTools == null) return;
  189. ToolItem source = moreTools.Find(c => c.Name == sourceAToolModule.Name);
  190. int targetIndex = quickTools.FindIndex(item => item.Name == targetAToolModule.Name);
  191. if (targetIndex < 0) return;
  192. if (!isMoreCuts)
  193. {
  194. ListMoreCuts.AllowDrop = false;
  195. sourceImage.Visibility = Visibility.Hidden;
  196. source = quickTools.Find(c => c.Name == sourceAToolModule.Name);
  197. if (source == null) return;
  198. int sourceIndex = quickTools.FindIndex(item => item.Name == sourceAToolModule.Name);
  199. if (sourceIndex < 0) return;
  200. var temp = quickTools[sourceIndex];
  201. quickTools[sourceIndex] = quickTools[targetIndex];
  202. quickTools[targetIndex] = temp;
  203. ListShortCuts.Items.Refresh();
  204. ListBoxCutsWidthChanged(ListShortCuts);
  205. }
  206. else
  207. {
  208. if (target == null) return;
  209. if (source == null) return;
  210. moreTools.Remove(source);
  211. moreTools.Insert(0, target);
  212. quickTools.Remove(target);
  213. quickTools.Insert(targetIndex, source);
  214. ListMoreCuts.Items.Refresh();
  215. ListShortCuts.Items.Refresh();
  216. sourceImage.Visibility = Visibility.Hidden;
  217. targetListItem.IsOverModular = false;
  218. ListBoxCutsWidthChanged(ListShortCuts);
  219. ListBoxCutsWidthChanged(ListMoreCuts);
  220. }
  221. }
  222. private void WorkingWithAnimation(Point pos)
  223. {
  224. sourceImage.Visibility = Visibility.Hidden;
  225. if (!isMoreCuts || !isMove)
  226. {
  227. moveImage.Visibility = Visibility.Hidden;
  228. }
  229. else
  230. {
  231. if (sourceListItem == null) return;
  232. moveImage.Visibility = Visibility.Visible;
  233. Point point = sourceListItem.TransformToAncestor(this).Transform(new Point(0, 0));
  234. ImageMoveTo(new Point(pos.X - 80, pos.Y), new Point(wrpnlPoint.X + 40, wrpnlPoint.Y), moveImage, 200);
  235. }
  236. }
  237. /// <summary>
  238. /// 图片移动动画
  239. /// </summary>
  240. /// <param name="curPoint">初始位置</param>
  241. /// <param name="deskPoint">控件要移动到的位置</param>
  242. /// <param name="ell">你要移动的空间</param>
  243. /// <param name="space">设置移动的时间片(关系到控件移动的速度)</param>
  244. private void ImageMoveTo(Point curPoint, Point deskPoint, Image ell, double space)
  245. {
  246. Storyboard storyboard = new Storyboard(); //创建Storyboard对象
  247. double lxspeed = space, lyspeed = space; //设置X方向 / Y方向 移动时间片
  248. //创建X轴方向动画
  249. DoubleAnimation dox = new DoubleAnimation(
  250. curPoint.X,
  251. deskPoint.X,
  252. new Duration(TimeSpan.FromMilliseconds(lxspeed))
  253. );
  254. //创建Y轴方向动画
  255. DoubleAnimation doy = new DoubleAnimation(
  256. curPoint.Y,
  257. deskPoint.Y,
  258. new Duration(TimeSpan.FromMilliseconds(lyspeed))
  259. );
  260. Storyboard.SetTarget(dox, ell);
  261. Storyboard.SetTarget(doy, ell);
  262. Storyboard.SetTargetProperty(dox, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.X)"));
  263. Storyboard.SetTargetProperty(doy, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)"));
  264. storyboard.Children.Add(dox);
  265. storyboard.Children.Add(doy);
  266. storyboard.Completed += Storyboard_Completed;
  267. //动画播放
  268. storyboard.Begin();
  269. }
  270. private void Storyboard_Completed(object sender, EventArgs e)
  271. {
  272. moveImage.Visibility = Visibility.Hidden;
  273. }
  274. /// <summary>
  275. /// 控件截图
  276. /// </summary>
  277. /// <param name="visual">控件</param>
  278. /// <param name="fileName">文件路径 C:\Users\oyxh\AppData\Local\Temp\</param>
  279. private void SaveToPng(FrameworkElement visual, string fileName)
  280. {
  281. DrawingVisual drawingVisual = new DrawingVisual();
  282. using (DrawingContext context = drawingVisual.RenderOpen())
  283. {
  284. VisualBrush brush = new VisualBrush(sourceListItem) { Stretch = Stretch.None };
  285. context.DrawRectangle(brush, null, new Rect(0, 0, sourceListItem.ActualWidth, sourceListItem.ActualHeight));
  286. context.Close();
  287. }
  288. RenderTargetBitmap targetBitmap = new RenderTargetBitmap((int)sourceListItem.ActualWidth, (int)sourceListItem.ActualHeight, 96d, 96d, PixelFormats.Default);
  289. targetBitmap.Render(drawingVisual);
  290. FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
  291. PngBitmapEncoder encoder = new PngBitmapEncoder();
  292. encoder.Interlace = PngInterlaceOption.On;
  293. encoder.Frames.Add(BitmapFrame.Create(targetBitmap));
  294. encoder.Save(stream);
  295. stream.Close();
  296. }
  297. private ToolItem target;
  298. private void ListBoxShortCuts_DragOver(object sender, DragEventArgs e)
  299. {
  300. var pos = e.GetPosition(ListShortCuts);
  301. Console.WriteLine($"pos:{pos.X} {pos.Y} this.Grid.ActualHeight1 {this.Grid.ActualHeight}");
  302. if (pos.Y < 0)
  303. {
  304. isMove = false;
  305. sourceImage.Visibility = Visibility.Hidden;
  306. sourceListItem = null;
  307. return;
  308. }
  309. if (pos.Y >= this.Grid.ActualHeight - 50)
  310. {
  311. isMove = false;
  312. sourceImage.Visibility = Visibility.Hidden;
  313. sourceListItem = null;
  314. return;
  315. }
  316. if (pos.X < 10)
  317. {
  318. isMove = false;
  319. sourceListItem = null;
  320. sourceImage.Visibility = Visibility.Hidden;
  321. return;
  322. }
  323. if (pos.X >= this.Grid.ActualWidth - 10)
  324. {
  325. isMove = false;
  326. sourceListItem = null;
  327. sourceImage.Visibility = Visibility.Hidden;
  328. return;
  329. }
  330. if (!isMoreCuts)
  331. {
  332. var sourceAToolModule = e.Data.GetData(typeof(ToolItem)) as ToolItem;
  333. if (sourceAToolModule == null) return;
  334. int sourceIndex = quickTools.FindIndex(item => item.Name == sourceAToolModule.Name);
  335. //根据index找listbox对应的item
  336. sourceListItem = (ListItemQuickTool)(ListShortCuts.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
  337. if (sourceListItem == null)
  338. {
  339. return;
  340. }
  341. ListMoreCuts.AllowDrop = false;
  342. sourceImage.Visibility = Visibility.Hidden;
  343. }
  344. else
  345. {
  346. var sourceAToolModule = e.Data.GetData(typeof(ToolItem)) as ToolItem;
  347. if (sourceAToolModule == null) return;
  348. int sourceIndex = moreTools.FindIndex(item => item.Name == sourceAToolModule.Name);
  349. //根据index找listbox对应的item
  350. sourceListItem = (ListItemQuickTool)(ListMoreCuts.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
  351. if (sourceListItem == null)
  352. {
  353. return;
  354. }
  355. isMove = true;
  356. //图片绑定
  357. ImageBinding(pos);
  358. }
  359. var result = VisualTreeHelper.HitTest(ListShortCuts, pos);
  360. if (result == null)
  361. {
  362. return;
  363. }
  364. //查找目标数据
  365. targetListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
  366. if (targetListItem == null)
  367. {
  368. //sourceImage.Visibility = Visibility.Hidden;
  369. return;
  370. }
  371. var targetAToolModule = targetListItem.Content as ToolItem;
  372. if (targetAToolModule == null) return;
  373. target = quickTools.Find(c => c.Name == targetAToolModule.Name);
  374. }
  375. /// <summary>
  376. ///图片绑定
  377. /// </summary>
  378. private void ImageBinding(System.Windows.Point pos)
  379. {
  380. sourceImage.Visibility = Visibility.Visible;
  381. sourceImage.Source = bitmapSource;
  382. sourceImage.Margin = new Thickness(pos.X - 80, pos.Y, 0, 0);
  383. moveImage.Source = sourceImage.Source;
  384. }
  385. private void ListBoxShortCuts_PreviewMouseMove(object sender, MouseEventArgs e)
  386. {
  387. if (e.LeftButton == MouseButtonState.Pressed)
  388. {
  389. ListMoreCuts.AllowDrop = false;
  390. var pos = e.GetPosition(ListShortCuts);
  391. HitTestResult result = VisualTreeHelper.HitTest(ListShortCuts, pos);
  392. if (result == null)
  393. {
  394. return;
  395. }
  396. quickSourceListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
  397. if (quickSourceListItem == null || quickSourceListItem.Content != ListShortCuts.SelectedItem)
  398. {
  399. return;
  400. }
  401. System.Windows.DataObject dataObj = new System.Windows.DataObject(quickSourceListItem.Content as ToolItem);
  402. if (dataObj != null)
  403. {
  404. isMoreCuts = false;
  405. DragDrop.DoDragDrop(ListShortCuts, dataObj, System.Windows.DragDropEffects.Move);
  406. }
  407. }
  408. else
  409. {
  410. sourceImage.Visibility = Visibility.Hidden;
  411. //moveImage.Visibility = Visibility.Hidden;
  412. }
  413. }
  414. private void sourceImage_Drop(object sender, DragEventArgs e)
  415. {
  416. ListBoxShortCuts_Drop(sender, e);
  417. }
  418. private void sourceImage_PreviewMouseMove(object sender, MouseEventArgs e)
  419. {
  420. ListBoxMoreCuts_PreviewMouseMove(sender, e);
  421. }
  422. private void sourceImage_DragOver(object sender, DragEventArgs e)
  423. {
  424. ListBoxShortCuts_DragOver(sender, e);
  425. }
  426. private void Label_PreviewMouseMove(object sender, MouseEventArgs e)
  427. {
  428. ListBoxMoreCuts_PreviewMouseMove(sender, e);
  429. }
  430. private void ListBoxMoreCuts_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  431. {
  432. //获取当前控件元素相对鼠标点击的位置(只有点击在当前A控件,会触发事件并返回相对A控件的鼠标位置)。
  433. Point pp = Mouse.GetPosition(e.Source as FrameworkElement);//WPF方法
  434. sourceImage.Visibility = Visibility.Hidden;
  435. if (pp.X < 0 || pp.Y < 0)
  436. {
  437. moveImage.Visibility = Visibility.Hidden;
  438. }
  439. }
  440. /// <summary>
  441. /// 扩展收缩UI
  442. /// </summary>
  443. /// <param name="IsShowConciseContent">是否收缩</param>
  444. private void ShowToolsUI(ListBoxEx list,bool IsShowConciseContent)
  445. {
  446. foreach (var item in list.Items)
  447. {
  448. var listBoxItem = list.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
  449. if (listBoxItem != null)
  450. {
  451. var viewItem = listBoxItem.ContentTemplate;
  452. var myContentPresenter = CommonHelper.FindVisualChild<ContentPresenter>(listBoxItem);
  453. var obj = viewItem.FindName("data", myContentPresenter);
  454. var checkNum = obj as PDFToolItem;
  455. if (checkNum != null)
  456. {
  457. checkNum.IsShowConciseContent = IsShowConciseContent;
  458. }
  459. }
  460. }
  461. }
  462. private void ListBoxShortCuts_SizeChanged(object sender, SizeChangedEventArgs e)
  463. {
  464. ListBoxCutsWidthChanged(ListShortCuts);
  465. }
  466. private void ListBoxMoreCuts_SizeChanged(object sender, SizeChangedEventArgs e)
  467. {
  468. ListBoxCutsWidthChanged(ListMoreCuts);
  469. }
  470. private void ListBoxCutsWidthChanged(ListBoxEx list)
  471. {
  472. //3x + 4y = containerWidth;
  473. //3x = y;
  474. //x为间距,y为item;
  475. double containerWidth = list.ActualWidth - 20;
  476. int widthItem = (int)containerWidth / 5;
  477. double margin = widthItem / 3;
  478. int i = 0;
  479. foreach (var item in list.Items)
  480. {
  481. i++;
  482. var listBoxItem = list.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
  483. if (listBoxItem != null)
  484. {
  485. if (i % 4 != 0)
  486. {
  487. listBoxItem.Margin = new Thickness(0, 0, margin, 0);
  488. }
  489. else
  490. {
  491. listBoxItem.Margin = new Thickness(0, 0, 0, 0);
  492. }
  493. listBoxItem.Width = widthItem;
  494. }
  495. }
  496. }
  497. private void BtnTools_Click(object sender, RoutedEventArgs e)
  498. {
  499. }
  500. bool isExtend = false;
  501. private void BtnMore_Click(object sender, RoutedEventArgs e)
  502. {
  503. if(isExtend)
  504. {
  505. isExtend = false;
  506. ShowToolsUI(ListShortCuts, false);
  507. ShowToolsUI(ListMoreCuts, false);
  508. }
  509. else
  510. {
  511. isExtend = true;
  512. ShowToolsUI(ListShortCuts, true);
  513. ShowToolsUI(ListMoreCuts, true);
  514. }
  515. }
  516. //自适应流式布局,以防改需求备用
  517. //private void ListBoxMoreCutsWidthChanged()
  518. //{
  519. // double containerWidth = ListBoxShortCuts.ActualWidth;
  520. // int Rowcount = (int)containerWidth / 240;
  521. // double EndRow = containerWidth % 240.0;
  522. // Rowcount = EndRow >= 140 ? ++Rowcount : Rowcount;
  523. // int i = 0;
  524. // foreach (var item in ListBoxMoreCuts.Items)
  525. // {
  526. // i++;
  527. // var listBoxItem = ListBoxMoreCuts.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
  528. // if (listBoxItem != null)
  529. // {
  530. // if (i % Rowcount != 0)
  531. // {
  532. // listBoxItem.Margin = new Thickness(0, 0, 100, 0);
  533. // }
  534. // else
  535. // {
  536. // listBoxItem.Margin = new Thickness(0, 0, 0, 0);
  537. // }
  538. // }
  539. // }
  540. //}
  541. }
  542. }