<ScrollViewer |
x:Name="m_SiteImageScroller" |
x:FieldModifier="private" |
Grid.Column="0" |
HorizontalScrollBarVisibility="Auto" |
VerticalScrollBarVisibility="Auto"> |
|
<Viewbox x:Name="m_SiteImageViewbox" x:FieldModifier="private"> |
<Viewbox.LayoutTransform> |
<ScaleTransform x:Name="m_Scale" x:FieldModifier="private" /> |
</Viewbox.LayoutTransform> |
<InkCanvas x:Name="m_DrawingLayer" EditingMode="None"> |
<Image x:Name="m_Image" x:FieldModifier="private" Source="Raw.jpg"> |
|
</Image> |
</InkCanvas> |
</Viewbox> |
</ScrollViewer> |
I then have some C# code which reads a Slider and assigns to ScaleTransform.ScaleX/ScaleY:
private void m_ScaleAdjuster_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) |
{ |
m_Scale.ScaleX = m_ScaleAdjuster.Value; |
m_Scale.ScaleY = m_ScaleAdjuster.Value; |
} |
Problem is, I can assign any values to the ScaleTransform's CenterX and CenterY properties (to scale from the middle rather than (0,0) ) and they have no effect whatsoever. NONE. I tried using the transform as a RenderTransform instead of a LayoutTransform and setting RenderTransformOrigin to (.5,.5). This works. The image scales from the center (but of course then I have the problems of doing the scaling behind the layout system's back). But I can't for the life of me get the LayoutTransform to work with the CenterX / CenterY properties.
Any ideas?
TIA,
John