1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- namespace PDF_Master.CustomControl
- {
- public class ListItemQuickTool : ListBoxItem
- {
- // 属性的定义与注册
- public static DependencyProperty IsOverModularProperty = DependencyProperty.Register("IsOverModular", typeof(bool), typeof(ListItemQuickTool), new PropertyMetadata(false));
- // 属性的包装
- public bool IsOverModular
- {
- get { return (bool)GetValue(IsOverModularProperty); }
- set { SetValue(IsOverModularProperty, value); }
- }
- protected override void OnDragEnter(DragEventArgs e)
- {
- base.OnDragEnter(e);
- IsOverModular = true;
- }
- protected override void OnDragLeave(DragEventArgs e)
- {
- base.OnDragLeave(e);
- IsOverModular = false;
- }
- protected override void OnDragOver(DragEventArgs e)
- {
- base.OnDragOver(e);
- IsOverModular = true;
- }
- protected override void OnDrop(DragEventArgs e)
- {
- base.OnDrop(e);
- IsOverModular = false;
- }
- protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e)
- {
- base.OnPreviewMouseLeftButtonUp(e);
- }
- }
- public class ListBoxEx : ListBox
- {
- protected override DependencyObject GetContainerForItemOverride() => new ListItemQuickTool();
- }
- }
|