Commits

Mark Heath committed c2434de

canvas autoscroll

Comments (0)

Files changed (2)

GraphPad/Logic/GraphRenderer.cs

             } while (overlaps);
 
             CreateConnections(graph);
+
+            canvas.Width = nodes.Values.Max(x => (double)x.GetValue(Canvas.LeftProperty) + x.Width + nodePadding);
+            canvas.Height = nodes.Values.Max(x => (double)x.GetValue(Canvas.TopProperty) + x.Height + nodePadding);
         }
 
         private void MoveDown(NodeInfo nodeInfo)

GraphPad/MainWindow.xaml

 <Window x:Class="GraphPad.MainWindow"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-        Title="MainWindow" Height="350" Width="525">
+        Title="MainWindow" Height="350" Width="800">
     <Grid>
         <Grid.ColumnDefinitions>
-            <ColumnDefinition Width="*" />
+            <ColumnDefinition Width="200" />
             <ColumnDefinition Width="*" />
         </Grid.ColumnDefinitions>
         <TextBox FontFamily="Consolas" AcceptsReturn="True" Grid.Column="0" x:Name="graphText"/>
         <GridSplitter Grid.Column="0" Width="5"/>
-        <Canvas Grid.Column="1" x:Name="graphCanvas" />
+        <ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
+            <Canvas x:Name="graphCanvas" />
+        </ScrollViewer>
     </Grid>
 </Window>