This project is read-only.

Stretch Document to current width / height

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

Hi,

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 3:10 PM
Edited Aug 31, 2012 at 3:11 PM

Hi Thimmey,

You should set the ViewModel of the DocumentViewer to FitHeight.

<doc:DocumentViewer>
  <doc:DocumentViewer.ViewMode>
    <doc:ViewMode ScaleMode="FitHeight" />
  </doc:DocumentViewer.ViewMode>
</doc:DocumentViewer>

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 11:23 AM

Thanks :-)