Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
XamTree HierarchicalItemTemplate with Drag and Drop
posted

I am trying to make the last item only dragable to a scheduler control. For the most part I have everything working, except the drag and drop. My treeView code is as followed:  

 <ig:XamTree x:Name="dataTree" Grid.Column="0" BorderThickness="0,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#FFFFFFFF" ItemsSource="{Binding Source={StaticResource ViewModel}, Path=TreeDepartments}" IsDraggable="True"> 

<ig:XamTree.HierarchicalItemTemplate>

<ig:HierarchicalDataTemplate ItemsSource="{Binding TimeAreas}">

 

 

 

 

<DataTemplate>

 

 

 

 

 

 

<TextBlock FontWeight="Bold" Text="{Binding Name}" />

 

 

 

 

 

 

</DataTemplate>

 

 

 

 

 

 

<ig:HierarchicalDataTemplate.HierarchicalItemTemplate>

 

 

 

 

 

 

<ig:HierarchicalDataTemplate ItemsSource="{Binding TimeTasks}">

 

 

 

 

 

 

<DataTemplate>

 

 

 

 

 

 

<TextBlock Text="{Binding Name}" />

 

 

 

 

 

 

</DataTemplate>

 

 

 

 

 

 

<ig:HierarchicalDataTemplate.HierarchicalItemTemplate>

 

 

 

 

 

 

<ig:HierarchicalDataTemplate ItemsSource="{Binding TimeSubTasks}">

 

 

 

 

<DataTemplate>

 

 

 

 

 

 

<TextBlock Text="{Binding Name}" />

 

 

 

 

 

 

</DataTemplate>

 

 

 

 

 

 

<ig:HierarchicalDataTemplate.HierarchicalItemTemplate>

 

 

 

 

<ig:HierarchicalDataTemplate>

 

 

 

 

 

 

<DataTemplate >

 

 

 

 

 

 

<TextBlock Text="{Binding Name}">

 

 

 

 

 

 

<ig:DragDropManager.DragSource>

 

 

 

 

 

 

<ig:DragSource x:Name="treeDragSource" IsDraggable="True" DragChannels="ChannelB" Drop="treeDragSource_Drop"></ig:DragSource>

 

 

 

 

 

 

</ig:DragDropManager.DragSource>

 

 

 

 

 

 

</TextBlock>

 

 

 

 

 

 

</DataTemplate>

 

 

 

 

</ig:HierarchicalDataTemplate>

 

 

 

 

</ig:HierarchicalDataTemplate.HierarchicalItemTemplate>

 

 

 

 

 

 

</ig:HierarchicalDataTemplate>

 

 

 

 

 

 

</ig:HierarchicalDataTemplate.HierarchicalItemTemplate>

 

 

 

 

 

 

</ig:HierarchicalDataTemplate>

 

 

 

 

 

 

</ig:HierarchicalDataTemplate.HierarchicalItemTemplate>

 

 

 

 

 

 

</ig:HierarchicalDataTemplate>

 

 

 

 

</ig:XamTree.HierarchicalItemTemplate> 

 

 

 

 

 

 

 

</ig:XamTree>

As you may notice the dragdropManager is on the textblock which isnt what I need. I need to be able to retrieve the whole tree of the item they are dragging. So somehow in the drop event I need the selected items parents information or equivalent of it.

 

I had this working before but on the xamtreeitem for example:

<

 

 

ig:XamTree x:Name="dataTree" Grid.Column="0" BorderThickness="0,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#FFFFFFFF" ItemsSource="{Binding Source={StaticResource ViewModel}, Path=TreeDepartments}" IsDraggable="True">

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<ig:XamTreeItem Header="Programs" IsExpanded

="True">

 

 

 

 

 

<ig:XamTreeItem Header

="Financial Programs">

 

 

 

 

<ig:XamTreeItem Header

="Calculator">

 

 

 

 

<ig:DragDropManager.DragSource

>

 

 

 

 

<ig:DragSource x:Name="treeDragSource" IsDraggable="True" DragChannels="ChannelB" Drop="treeDragSource_Drop"></ig:DragSource

>

 

 

 

 

</ig:DragDropManager.DragSource

>

 

 

 

 

</ig:XamTreeItem

>

 

 

 

 

</ig:XamTreeItem

>

 

 

 

 

<ig:XamTreeItem Header

="Photo Editor"/>

 

 

 

 

</ig:XamTreeItem

>

 

</ig:XamTree> 

Any Ideas how to get the hierarchy to work simularly as the tree item?