View Implementations

The default view for presenting graphs, class GraphControl, is hierarchy-aware by default. All application-level features described in the section called “Class GraphControl”, like, e.g., clipboard functionality or Undo/Redo are available for grouped graphs out-of-the-box.

Class NodeHierarchyView

Class NodeHierarchyView can be used to present the tree-like hierarchy modeled by an IHierarchy implementation in a WPF application.

Example 3.8, “XAML NodeHierarchyView setup” presents the XAML setup of a NodeHierarchyView for displaying the hierarchical organization of a grouped graph.

Example 3.8. XAML NodeHierarchyView setup

<Grid>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="50*"/>
    <ColumnDefinition Width="5"/>
    <ColumnDefinition Width="300*"/>
  </Grid.ColumnDefinitions>
  <Grid Grid.Column="0">
    <Grid.RowDefinitions>
      <RowDefinition Height="50*"/>
      <RowDefinition Height="5"/>
      <RowDefinition Height="200*"/>
    </Grid.RowDefinitions>
    <y:GraphOverviewControl Grid.Row="0" 
        GraphControl="{Binding ElementName=graphControl}"/>
    <GridSplitter Grid.Row="1" Height="5" 
        HorizontalAlignment="Stretch" VerticalAlignment="Top" 
        Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" 
        ResizeDirection="Rows" ResizeBehavior="PreviousAndNext"/>
    <y:NodeHierarchyView Grid.Row="2" Name="hierarchyTreeView" 
        Graph="{Binding ElementName=graphControl, Path=Graph}" 
        ShowMasterHierarchy="False"/>
  </Grid>
  <GridSplitter Grid.Column="1" Width="5" 
      Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" 
      ResizeDirection="Columns" ResizeBehavior="PreviousAndNext"/>
  <y:GraphControl Grid.Column="2" Width="Auto" Name="graphControl" 
                  InputMode="{StaticResource EditMode}"/>
</Grid>

NodeHierarchyView uses the first label of each node as the descriptive text to be displayed. Figure 3.11, “Graph view provided by NodeHierarchyView” shows a NodeHierarchyView placed on the left side inside an application's window that displays the hierarchical organization of the folding-enabled graph from a managed view.

Figure 3.11. Graph view provided by NodeHierarchyView

Graph view provided by NodeHierarchyView.

NodeHierarchyView supports different content presentation policies with regard to folding-enabled graphs. The ShowMasterHierarchy property can be used to set whether the tree-like view should always use the master graph's hierarchy or the hierarchy of the managed view's graph.