I have an area that users can draw in. I would like them to be able to zoom on it, and also to be able to scroll (so that it's not permanently clipped if they resize the window smaller.) So I have this:
<ScrollViewer VerticalScrollMode="Enabled" VerticalScrollBarVisibility="Auto" HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Auto" ZoomMode="Enabled" MinZoomFactor="1">
<ItemsControl ItemsSource="{Binding DisplaySlides, Mode=OneWay}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Grid/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</ScrollViewer>
And the template for the drawing area is this:
<Grid Background="White" Opacity="0.8">
<!-- Inking area -->
<InkCanvas x:Name="inkCanvas"/>
</Grid>
The problem is that if I resize the window or zoom in, scrolling doesn't actually work. In the "sponge space" (the little bit of "elastic" a ScrollViewer
gives when you try to scroll and it can't) I can see that the InkCanvas
does indeed extend beyond the bounds of the ScrollViewer
. But it just won't scroll. I'm guessing that I should be using a Canvas
instead of a Grid
or something, but when I do that it doesn't even show my InkCanvas
.
(The worst part is that I had this working.... Then accidentally deleted the project. Now I've been trying for hours and can't get it to work again for the life of me.)