How to implement Drag and Drop Frame work with XamWebTree to drag and drop folder or XamWebTreeItem with in Tree. I am not using Drag-Drop facility of XamWebTree
Thanks .It works but not scroll smoothly.
While draging XamWebTreeItem having expandend with children also move in expanded form. If i set IsExpanded = false to DragSource.It collapse source but not moving item(XamWebTreeItem). How can i achieve , moving item should collapse but not original source item.
Hi,
If you notice in Widow Explorer when you drag some item over last visible item (or over item that is before last visible item) and if there are more items that are hidden the scroll moves automatically so next item become visible. You can subscribe for DragEnter event (when all items are drop targets), then you can determine the item that is your current drop target and if there are more items you may be able to set scroller where you want. When DragEnter event is fired you can use DragDropCancelEventArgs.DropTarget property to obtain current drop target element or DragDropCancelEventArgs.Data property to get the data object.
PPilev.
Thanks guys for your input and solution. i find soution. i populate XamWebTree dynamically by adding nodes as i want. I achieved DragNDrop Folder and File(leaf node) by attaching DragManager ,DragTarget to XamWebTreeItem. It works fine.
One more feature i want Here. I want Auto-Scrolling XamWebTree as i drag node over tree like Window Explorer supports.
Could you please help me to achieve Auto-scrolling XamWebTree while using Drag-n-Drop framework.
I think you should use model where files and folders have shared collection. May this sample will help you:
public interface IFileObject{ string Name { get; set; } Image Image { get; set; } Collection<IFileObject> Children { get; } bool HasChildren { get; }}
public class File : IFileObject{ // provide specific for the File object implementation}
public class Folder : IFileObject{ // provide specific for the Folder object implementation }
public class Drive{ public Collection<Folder> Folders { get; }}
or you can consider that Drive class also can implements IFileObject. It depends on your logic and what do you need. Then XamWebTree can be bound to Folders property (or Children property if Drive class implements IFileObject) as ItemsSource.
Best regards. PPilev
Class Drive {
string drivename;
Image driveIcon;
Folder rootFolder;
}
Class File{
string filename;
Image fileIcon;
Class Folder {
string name;
Image folderIcon;
Collection <Folder> Children; // n-level
Collection <File> files; // Leaf node
I have to bind Drive class instance with XamWebTree. How can i design time using HierarchicalDataTemplate for above Hierarchical structrue .