Articles in this section
Category / Section

How to enable drag the node from one diagram to another WPF Diagram (SfDiagram)?

1 min read

Dragging the Node from one Diagram to another Diagram is possible by adding the GraphConstraints.FloatElements constraints to the WPF Diagram (SfDiagram).

Xaml

<Grid>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="750"/>
    <ColumnDefinition Width="750"/>
  </Grid.ColumnDefinitions>
  <Grid Grid.Column="0">
    <Syncfusion:SfDiagram x:Name="diagram1" Grid.Column="0" BorderBrush="DarkBlue" BorderThickness="4" AllowDrop="True" Constraints="Default,FloatElements">
      <Syncfusion:SfDiagram.Nodes>
        <Syncfusion:NodeCollection>
          <Syncfusion:NodeViewModel UnitHeight="100" UnitWidth="100" OffsetX="100" OffsetY="100"/>
        </Syncfusion:NodeCollection>
      </Syncfusion:SfDiagram.Nodes>
      <Syncfusion:SfDiagram.Connectors>
        <Syncfusion:ConnectorCollection/>
      </Syncfusion:SfDiagram.Connectors>
    </Syncfusion:SfDiagram>
  </Grid>
  <Grid Grid.Column="1">
    <Syncfusion:SfDiagram x:Name="diagram2" Grid.Column="1" BorderBrush="Yellow" BorderThickness="4" AllowDrop="True" Constraints="Default,FloatElements">
      <Syncfusion:SfDiagram.Nodes>
        <Syncfusion:NodeCollection/>
      </Syncfusion:SfDiagram.Nodes>
      <Syncfusion:SfDiagram.Connectors>
        <Syncfusion:ConnectorCollection/>
      </Syncfusion:SfDiagram.Connectors>
    </Syncfusion:SfDiagram>
  </Grid>
</Grid>

 

Floatelements

View sample in GitHub.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied