How to set an Image fit to width of ScrollViewer

Posted by Raj on Stack Overflow See other posts from Stack Overflow or by Raj
Published on 2010-02-25T15:10:56Z Indexed on 2010/05/05 22:58 UTC
Read the original article Hit count: 283

Filed under:
|
|

I've Image placed inside a ScrollViewer.

<ScrollViewer x:Name="imageScroller" Grid.Column="2" Margin="5" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
    <Image x:Name="imageViewer" Cursor="Hand" RenderTransformOrigin="0,0" Margin="0">
        <Image.LayoutTransform>
            <ScaleTransform ScaleX="{Binding Path=Zoom, Converter={StaticResource debugConverter}}" ScaleY="{Binding Path=Zoom, Converter={StaticResource debugConverter}}"/>
        </Image.LayoutTransform>
    </Image>
</ScrollViewer>

How do I zoom image like "fit-to-width" in document viewers to the size and height of ScrollViewer?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about c#