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

<UserControl x:Class="LocalExpand.LocalExpand"
    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:LocalExpand">

  <FrameworkElement.Resources>
    <DataTemplate x:Key="NodeTemplate">
      <go:NodePanel Sizing="Fixed" go:Part.SelectionAdorned="True">
        <go:NodeShape go:NodePanel.Figure="RoundedRectangle"
              Width="30" Height="30"
              Stroke="Orange" StrokeThickness="1" Fill="White" />
        <TextBlock Text="{Binding Path=Data.Key}"
                   HorizontalAlignment="Center" VerticalAlignment="Center" />
      </go:NodePanel>
    </DataTemplate>

    <DataTemplate x:Key="GroupTemplate">
      <Border BorderThickness="1" BorderBrush="LightBlue" Background="Transparent"
              go:Part.SelectionAdorned="True"
              go:Node.LocationElementName="myGroupPanel">
        <StackPanel>
          <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
            <TextBlock Text="{Binding Path=Data.Key}" FontWeight="Bold" />
          </StackPanel>
          <go:GroupPanel x:Name="myGroupPanel" Padding="5" />
        </StackPanel>
        <go:Group.Layout>
          <go:ForceDirectedLayout />
        </go:Group.Layout>
      </Border>
    </DataTemplate>
  </FrameworkElement.Resources>

  <Grid>
    <go:Diagram x:Name="myDiagram" Padding="10"
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch"
                NodeTemplate="{StaticResource NodeTemplate}"
                GroupTemplate="{StaticResource GroupTemplate}">
      <go:Diagram.Layout>
        <go:ForceDirectedLayout />
      </go:Diagram.Layout>
    </go:Diagram>
  </Grid>
</UserControl>