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

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

  <UserControl.Resources>
    <DataTemplate x:Key="TypeNodeTemplate">
      <!-- show the Name of each TypeInfo -->
      <!-- links come into at the middle of the left side,
           and go out at the middle of the right side -->
      <TextBlock Text="{Binding Path=Data.Name}" go:Part.SelectionAdorned="True"
                 go:Node.ToSpot="MiddleLeft" go:Node.FromSpot="MiddleRight">
        <!-- but the user can see the fully qualified type name in a tooltip -->
        <ToolTipService.ToolTip>
          <TextBlock Text="{Binding Path=Data.FullName}" />
        </ToolTipService.ToolTip>
      </TextBlock>
    </DataTemplate>

    <DataTemplate x:Key="LinkTemplate">
      <!-- just a line; no arrowhead is needed for this sample -->
      <go:LinkShape Stroke="Black" StrokeThickness="1"
                    go:Link.Selectable="False" />
    </DataTemplate>
  </UserControl.Resources>

  <Grid>
    <!-- initially show the bottom right corner of the graph at the
         bottom right corner of the diagram panel -->
    <go:Diagram x:Name="myDiagram"
                InitialPanelSpot="BottomRight"
                InitialDiagramBoundsSpot="BottomRight"
                HorizontalContentAlignment="Left"
                VerticalContentAlignment="Top"
                NodeTemplate="{StaticResource TypeNodeTemplate}"
                LinkTemplate="{StaticResource LinkTemplate}">
      <go:Diagram.Layout>
        <!-- do a simple tree layout -->
        <go:TreeLayout NodeSpacing="5" />
      </go:Diagram.Layout>
    </go:Diagram>
  </Grid>
</UserControl>
