How to drag drop items between the nodes (Entity

Hi,

We have the following requriement.

We have nodes like as you can see in EntityRelationShip sample.
We want to drag an item from one entity to another entity.
How can we do that…

We can add datagrid or listbox inside the datatemplate but drag drop is not supported when we tried to add that inside the datatemplate.

Is there any way we can achieve this.

Why can’t you drag from controls you put inside the Nodes? That should work.

BTW, are you using Silverlight or WPF? Which platform version?

what we have done is we have placed a listbox inside the datatemplate
and we will assign values at runtime
so when the node got render it will render the listbox
and our requirement is drag and drop items between the listbox
please help us

If you’re just doing drag-and-drop between ListBoxes, then you just need to implement regular drag-and-drop, as if they weren’t inside Nodes inside a Diagram.

I suggest you learn about implementing drag-and-drop on whichever platform you are using.

listbox or datagrid is present inside the node…ie inside the Datatemplate

have a look the following code

    <Grid AllowDrop="True">
        
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*"  />
      </Grid.RowDefinitions>
      <Grid Grid.Row="0">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="0" HorizontalAlignment="Center"
                   Text="{Binding Path=Data.Key}" FontWeight="Bold" />
        <Button Grid.Column="1" Content="*" Click="Button_Click" />
      </Grid>
                <font color="#FF0000"><u><toolkit:DataGridDragDropTarget  Grid.Row="1" DataContext="{Binding}" Height="300" AllowDrop="True"  Name="dataGridDragDropTarget1" Width="100"></u></font>
                <grid:DataGrid AutoGenerateColumns="False" AllowDrop="True"
                     Background="White" HorizontalAlignment="Stretch"
                     ItemsSource="{Binding Path=Data.Items}">
        <grid:DataGrid.Columns>
          <grid:DataGridTemplateColumn>
            <grid:DataGridTemplateColumn.CellTemplate >
              <DataTemplate>
                <go:NodePanel AllowDrop="True">
                  <Path go:NodePanel.Figure="{Binding Path=Figure}"
                        Width="10" Height="10"
                        Fill="{Binding Path=Color}"
                        Stroke="Black" StrokeThickness="1" />
                </go:NodePanel>
              </DataTemplate>
            </grid:DataGridTemplateColumn.CellTemplate>
          </grid:DataGridTemplateColumn>
          <grid:DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" />
        </grid:DataGrid.Columns>
      </grid:DataGrid>
              <font color="#FF0000">  </toolkit:DataGridDragDropTarget></font>
            </Grid>
  </Border>
</DataTemplate>

any update on the above query…

I’m sorry, but I didn’t see any query in your post with all of that XAML.

I suggest you create two DataGrids in a page, without any use of GoXam, and get drag-and-drop working the way you want.

Then once you know you have everything working, you can embed a DataGrid in the DataTemplate for diagram nodes.

Your node DataTemplate will probably have other FrameworkElements in them that would be appropriate for use in a diagram, such as a header and some border(s). Those might be useful for allowing the user to select and maybe drag the node, without invoking drag-and-drop from the items in your DataGrid.