<!-- Copyright © Northwoods Software Corporation, 2008-2026. All Rights Reserved. -->

<UserControl x:Class="InteractiveForce.InteractiveForce"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:go="http://schemas.nwoods.com/GoXam"
    xmlns:local="clr-namespace:InteractiveForce">

  <FrameworkElement.Resources>
    <DataTemplate x:Key="nodeTemplate1">
      <go:NodePanel Sizing="Auto"
          go:Part.SelectionAdorned="True" go:Part.SelectionElementName="ellipse">
        <go:NodeShape go:NodePanel.Figure="Ellipse" x:Name="ellipse"
            Fill="{Binding Path=Data.Color}" StrokeThickness="2"
            go:Node.LinkableFrom="True" go:Node.LinkableTo="True"
            go:Node.LinkableDuplicates="True" Cursor="Hand" />
        <TextBlock Text="{Binding Path=Data.Key}" Foreground="Black"
                   TextWrapping="Wrap" Margin="10" />
      </go:NodePanel>
    </DataTemplate>
  </FrameworkElement.Resources>

  <Grid>
    <go:Diagram x:Name="myDiagram"
                InitialStretch="UniformToFill"
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch"
                NodeTemplate="{StaticResource nodeTemplate1}">
      <!-- as the user drags the selection, perform a layout -->
      <go:Diagram.DraggingTool>
        <local:ContinuousDraggingTool />
      </go:Diagram.DraggingTool>
      <!-- don't layout selected nodes: they might be being dragged -->
      <go:Diagram.Layout>
        <local:ContinuousForceDirectedLayout Conditions="None" />
      </go:Diagram.Layout>
      <!-- optimize layout operations -->
      <go:Diagram.LayoutManager>
        <local:ContinuousLayoutManager />
      </go:Diagram.LayoutManager>
    </go:Diagram>
  </Grid>
</UserControl>
