拖拽 treeview_Vuetify可拖动的v-treeview组件

拖拽 treeview

vuetify-可拖动树视图 (vuetify-draggable-treeview)

Drag and drop v-treeview (Vuetify Treeview) component.

拖放v-treeview(Vuetify Treeview)组件。

vuetify-draggable-treeview

安装 (Installation)

yar
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
V5.3.0: (04 Jan 2014) - Fix for issue #159 (Cursor missing in edit with non-standard DPI): Ensuring a minimum size of the edit control - Fixed issue #403: Declare TVTGetNodeProc as reference to procedure (for D2009+) - Fixed issue #402: TVTEdit.CNCommand discard all notification except EN_UPDATE due to missing inherited - Corrected fix for issue #376 (Incorrect selection paint when toGridExtensions is included in the MiscOptions) - Fixed issue #401: OnNodeClick event doesn't trigger in some case, coFixed set for a column - Modified #316 (concerning r498). The fix for #316 will only be applied in case toMultiSelect is set. If toMultiSelect is not set we can start a drag anywhere in the row. - ContentToHTML() and ContentToRTF() now return a string of type RawByteString. Because the generated strings are pre-encoded in UTF-8, the previous type AnsiString caused problems in Delphi 2009+ e.g. when this string was written using the VCL TStreamWriter class. The helper class TBufferedAnsiString therefore uses RywByteString now as type too. - Fixed issue #399: EditDelay not working - Fixed issue #400: AltGr+A does not behave as expected for foreign keyboard layouts in VTEdit - Fixed issue #388: VirtualStringTree with toFixedIndent causes range check error - Edit box when editing a node in a tree with toFixedIndent now has the correct indent - Fixed issue #392: Now ensuring that MeasureItemHeight() is only called from the main thread. - Fixed #383: Clear vsHasChildren for a node without children even if the children count didn't change. - Fixed #377: Wrong font (size, etc) in TargetCanvas in MeasureItem for first node - Fixed issue #398 (hoAutoResize causes DFM designer to be modified after loading) by calling TControl.Updating()/Updated() in AdjustAutoSize() - Preventing possible AV in TBaseVirtualTree.FontChanged() - Fixed 32Bit Integer overflows in Win64 build in TBufferedAnsiString.
WPF 中的 TreeView 控件本身不支持拖拽操作,但我们可以通过在 TreeView 上使用 PreviewMouseDown、MouseMove 和 PreviewMouseUp 事件来实现拖拽功能。 下面是一个简单的示例: ```xml <TreeView x:Name="myTreeView" PreviewMouseDown="MyTreeView_PreviewMouseDown" PreviewMouseMove="MyTreeView_PreviewMouseMove" PreviewMouseUp="MyTreeView_PreviewMouseUp"> <!-- TreeView 的内容 --> </TreeView> ``` 在代码中,我们需要定义一些变量来跟踪当前的拖拽操作: ```csharp private bool isDragging; private TreeViewItem draggedItem; private object draggedData; private bool isMouseDown; private Point clickPosition; ``` 然后,我们可以在 PreviewMouseDown 事件中记录鼠标单击位置和拖拽的数据: ```csharp private void MyTreeView_PreviewMouseDown(object sender, MouseButtonEventArgs e) { isMouseDown = true; clickPosition = e.GetPosition(myTreeView); var item = VisualUpwardSearch(e.OriginalSource as DependencyObject); if (item != null) { draggedItem = item; draggedData = draggedItem.DataContext; } } ``` 接下来,在 PreviewMouseMove 事件中检查是否开始了拖拽操作,如果是,则开始拖拽,并在 PreviewMouseUp 事件中结束拖拽: ```csharp private void MyTreeView_PreviewMouseMove(object sender, MouseEventArgs e) { if (isMouseDown && (Math.Abs(e.GetPosition(myTreeView).X - clickPosition.X) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs(e.GetPosition(myTreeView).Y - clickPosition.Y) > SystemParameters.MinimumVerticalDragDistance)) { isDragging = true; DragDrop.DoDragDrop(draggedItem, draggedData, DragDropEffects.Move); } } private void MyTreeView_PreviewMouseUp(object sender, MouseButtonEventArgs e) { isMouseDown = false; if (isDragging) { isDragging = false; draggedItem = null; draggedData = null; } } ``` 最后,我们需要实现一个辅助方法,该方法可以从 TreeViewItem 的 VisualTree 中查找包含数据的项: ```csharp private TreeViewItem VisualUpwardSearch(DependencyObject source) { while (source != null && !(source is TreeViewItem)) { source = VisualTreeHelper.GetParent(source); } return source as TreeViewItem; } ``` 通过这些代码,我们可以实现 WPF 中的 TreeView 拖拽功能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值