简体   繁体   English

Silverlight 4拖放Treeview

[英]Silverlight 4 Drag and Drop Treeview

Does anyone have an example for any of the following scenarios. 是否有人针对以下任何情况提供示例。

Given, these are all dynamically populated trees. 给定,这些都是动态填充的树。 Not using a Heirarchal data template, but by iterating through object collections manually and appending children at the appropriate level. 不使用Heirarchal数据模板,而是通过手动遍历对象集合并在适当级别附加子级。

  1. Treeview1 has 3 levels, but items can only be reordered within their level. Treeview1具有3个级别,但只能在其级别内对项目进行重新排序。 So, lets say we have Drives, Folders and Files. 因此,可以说我们有驱动器,文件夹和文件。 Drives can be rearranged in an order, but not put into a Folder. 可以按顺序重新排列驱动器,但不能将其放入“文件夹”中。 When navigated down one level in a drive, the individual folders can be reordered, but not dragged between drives.. and same with files, only can be reordered, but not moved to a different folder or drive 在驱动器中向下导航时,各个文件夹可以重新排序,但不能在驱动器之间拖动。.和文件相同,只能重新排序,而不能移动到其他文件夹或驱动器

  2. I have 2 treeviews, Treeview1 is the same as #1 above and Treeview2 is like a picklist of available items. 我有2个树视图,树视图1与上面的#1相同,树视图2就像可用项目的选择列表。 A user can drag an item from Treeview2 to Treeview1, but it can only be placed at Treeview1's File Level. 用户可以将一项从Treeview2拖到Treeview1,但是只能将其放置在Treeview1的文件级别。 The dragged item cannot be a child of a file, or placed at the folder level, nor placed at the drive level. 拖动的项目不能是文件的子级,也不能位于文件夹级别,也不能位于驱动器级别。 Also, how to handle the Above, On Top, or Below an item. 另外,如何处理项目的上方,上方或下方。

I have yet to come across these examples. 我还没有碰到这些例子。

You should make 1 ListBoxDragDropTarget with a list box in it. 您应该使1个ListBoxDragDropTarget带有一个列表框。 The listbox has 3 item. 列表框有3个项目。 Each item contains Listbox DragDropTarget with a list box in it. 每个项目都包含列表框DragDropTarget,其中包含一个列表框。 And every sub level contains an listbox again for all the files. 每个子级别又包含一个用于所有文件的列表框。 With a little effort you can create your own listboxitem which has a button to open or close it like a treeview. 只需一点努力,您就可以创建自己的listboxitem,它具有像树视图一样打开或关闭它的按钮。 And tada,, you can rearrange the items but no the levels. 而tada,您可以重新排列项目,但不能重新排列级别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM