1

I have the following xaml.

<ScrollViewer HorizontalAlignment="Stretch" Margin="107,0,0,0" Name="scrollViewer1" VerticalAlignment="Stretch" HorizontalScrollBarVisibility="Visible">
    <Image Name="image1" Stretch="None" MouseWheel="image1_MouseWheel" RenderTransformOrigin="0,0">
    </Image>
</ScrollViewer>

An the following code behind.

// initialise.
private TransformGroup group = new TransformGroup();
private ScaleTransform st = new ScaleTransform();
group.Children.Add(st);
image1.RenderTransform = group

// mouse event.
TransformGroup group = (TransformGroup)image1.RenderTransform;
ScaleTransform scale = (ScaleTransform)group.Children.Last();
double zoom = e.Delta > 0 ? .2 : -.2;
scale.ScaleX += zoom;
scale.ScaleY += zoom;

How do I get the scroller to take into account that the image is now a different size. The scroll bars remain the same size, and I cannot work out how to change them.

Thanks

Jim
  • 14,952
  • 15
  • 80
  • 167

2 Answers2

1

You need the LayoutTransformer from the Silverlight Toolkit. Instead of setting a RenderTransform on your Image, put it inside a LayoutTransformer.

KeithMahoney
  • 3,323
  • 19
  • 10
0

have you tried calling InvalidateScrollInfo on the scrollviewer?

Mark
  • 14,820
  • 17
  • 99
  • 159
  • Yes. The scrollable area is still incorrect. I is either way too massive or way too small once the contents are scaled as per my code. – Jim Oct 13 '10 at 11:21