Stretch Document to current width / height

Aug 31, 2012 at 1:57 PM
Edited Aug 31, 2012 at 1:58 PM


I'm trying the document toolkit library. I've added a document viewer with a fixed height of 300 pixel. Instead of shrinking the document the viewer displays a vertical scrollbar.

Is it possible to disable tell the document viewer that it should just display the xps file "smaller" to fit the document viewer height?

<doc:DocumentViewer Grid.Row="1" Height="300"  x:Name="xpsViewer" DocumentDataSource="{Binding ElementName=DataSource}" Margin="0,0,0,33" VerticalAlignment="Top" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
        <doc:DocumentDataSource x:Name="DataSource" LoadError="DataSource_LoadError" />

Aug 31, 2012 at 2:10 PM
Edited Aug 31, 2012 at 2:11 PM

Hi Thimmey,

You should set the ViewModel of the DocumentViewer to FitHeight.

    <doc:ViewMode ScaleMode="FitHeight" />

This ensures that the height of a single document page fits in the viewport. When the documents contains more than 1 page, a scrollbar appears for navigating between pages.

Sep 5, 2012 at 10:23 AM

Thanks :-)