Neil Johnson

Neil Johnson

  • 1.9k
  • 124
  • 252

How do I adjust the graph with scroll viewer in WPF

Sep 13 2018 6:59 AM
I am getting the required output graph from my C# code.
 
The graph length is very big and I am only able to view some part of it.
 
I tried to use ScrollViewer. But I cannot see the ScrollViewer. Also I am getting the trimmed graph.
 
Please have a look at UI code.
 
The user first clicks on Button. Then he selects the file from dialog box.
 
Then a graph is drawn from the data of that file...
 
<Window Title="MainWindow" Height="500" Width="800">
<StackPanel Orientation="Vertical">
<Button Content="Select File" Height="32" Width="88" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,10,10,10" Name="button1" Click="button1_Click" />
<ScrollViewer Height="1800" Width="2000" CanContentScroll="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Canvas x:Name="front_canvas" Height="auto" Width="auto"/>
</ScrollViewer>
</StackPanel>
</Window>