Drag Drog Issue / Question

3 replies. Last post: September 30, 2011 6:01 PM by Taj James
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Taj JamesMember

I am having a slight issue with DataTemplates and the <Intersoft:DragDropBehavior/> behavior.


I have 2 collections in 2 different tabitems of a tab control.  

The first collection is a list of text labels that the user should be able to drag onto the drawing surface.  For this, I have used a UXListBox Bound to a collection of labels.  My ItemTemplate for the UXListBox is as follows:

        <DataTemplate x:Key="TextLibTemplate">
            <Border>
                <StackPanel Orientation="Horizontal" >
                    <TextBlock Text="{Binding Text}" FontSize="14" Tag="TextLib">
                        <i:Interaction.Behaviors>
                            <Intersoft:DragDropBehavior DragDropScope="Global" />
                        </i:Interaction.Behaviors>
                    </TextBlock>
                </StackPanel>
            </Border>
        </DataTemplate>

 The DragDrop functionality works perfectly for this.


However my 2nd list is a Hierarchical list of symbols that the user can drag onto the sketch surface, and for this I have used a UXTreeView control.  I am using an <Intersoft:HierarchicalDataTemplate/> for the ItemTemplate on this UXTreeView.  The HierarchicalDataTemplate is as follows:

        <Intersoft:HierarchicalDataTemplate x:Key="SymbolLibTemplate" ItemsSource="{Binding Symbols}">
            <Border>
                <StackPanel Orientation="Horizontal" >
                    <TextBlock Text="{Binding Name}" FontSize="14" Foreground="Blue" />
                    <i:Interaction.Behaviors>
                        <Intersoft:DragDropBehavior IsDragable="False" />
                    </i:Interaction.Behaviors>
                </StackPanel>
            </Border>
            <Intersoft:HierarchicalDataTemplate.ItemTemplate>
                <Intersoft:HierarchicalDataTemplate>
                    <Border>
                        <StackPanel Orientation="Horizontal">
                            <Image Width="24" Height="24" Source="Assets/Images/icons/Symbols.png" />
                            <TextBlock Text="{Binding Name}" FontSize="14" Tag="SymbolLib" />
                            <i:Interaction.Behaviors>
                                <Intersoft:DragDropBehavior IsDragable="True" DragDropScope="Global" />
                            </i:Interaction.Behaviors>
                        </StackPanel>
                    </Border>
                </Intersoft:HierarchicalDataTemplate>
            </Intersoft:HierarchicalDataTemplate.ItemTemplate>
        </Intersoft:HierarchicalDataTemplate>

 The Hierarchial list groups and list items show up in the UXTreeView control perfectly, however the DragDrop behavior has no effect here and does not work.

I have tried this in a very simplified manner as well using a HierarchicalDataTemplate like:

        <Intersoft:HierarchicalDataTemplate x:Key="SymbolLibTemplate2">
            <Border>
                <StackPanel Orientation="Horizontal" >
                    <TextBlock Text="{Binding Name}" FontSize="14" Tag="SymbolLib">
                        <i:Interaction.Behaviors>
                            <Intersoft:DragDropBehavior DragDropScope="Global" />
                        </i:Interaction.Behaviors>
                    </TextBlock>
                </StackPanel>
            </Border>
        </Intersoft:HierarchicalDataTemplate>

 to ensure that the additional complexity of the Hierarchical DataTemplate was not causing a problem.

The <Intersoft:DragDropBehavior/> just flat out, does not appear to work with the <Intersoft:HierarchicalDataTemplate/>.  Which is preventing the DragDrop behavior from working at all with the UXTreeView.

Can you see anything that I am doing wrong here that may explain why I am not getting any kind of DragDrop behavior when i use the <Intersoft:HierarchicalDataTemplate/> as apposed to a regular <DataTemplat/>?

Just as an FYI, here is the main sketch surface of the application where both the text label adn symbol items are dropped.  Again the text labels using a UXListBox and a normal <DataTemplate/> work perfectly, however the UXTreeView using a <Intersoft:HierarchicalDataTemplate/> does not work at all.

          <Intersoft:UXFrame x:Name="SketchFrame" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="{Binding SketchPad}" MouseEnter="SketchFrame_MouseEnter" Cursor="None">
                    <i:Interaction.Behaviors>
                        <Intersoft:DropTargetBehavior AllowDropItem="True" DropBehavior="Custom" Drop="SketchFrame_Drop" />
                    </i:Interaction.Behaviors>
          </Intersoft:UXFrame>

 Thank you in advance for any insight you may be able to provide that will help me get this working with the UXTreeView.

All times are GMT -5. The time now is 9:19 PM.
Previous Next