Changing orientation to landscape

Sep 28, 2010 at 9:52 AM


  Is it possible to change the orientation of the pages of a given document to landscape (or the other way around).

  I would like to provide users a functionallity to rotate the pages whenever they need it.



Sep 28, 2010 at 12:45 PM

Yes, you should create a custom DocumentViewer style and add a RotateTransform Rendertransform to the FixedPageViewer. Bind the Angle property to a globally accessible property that provides the page orientation. Also make sure RenderTransformOrigin is set to .5,.5 for proper rotation.

- Koen

Sep 28, 2010 at 2:09 PM

then the scrollViewer won't get notified? (no resizing of width)?



Sep 28, 2010 at 2:41 PM

Yes, you are right, RenderTransform doesn't participate in the layout process. You'll need the LayoutTransformer from the Silverlight Toolkit that does provide this functionality.

- Koen

Dec 8, 2011 at 11:26 AM
Edited Dec 8, 2011 at 12:00 PM

How to allow Rotation and TextSelection (highlight, copy...) ?

I created the roration tutorial with the rorate icon at bottom right, but text selection is hidden.

In fact, it seems templating the documentviewer disables text mode. It should be great to keep text control and possibility for rotate, watermark... How to do that if possible please ?

Dec 8, 2011 at 2:26 PM

You can enable/disable the text selection by modifying the IsEnabled property of the TextSelection instance that is assigned to the DocumentViewer.

- koen

Dec 8, 2011 at 2:31 PM

I did it (IsEnabled = true), but in this case, it seems i can't create a template for the documentviewer. All tutorials made with text selection enabled do not use viewer template.

Dec 8, 2011 at 2:37 PM
Edited Dec 8, 2011 at 2:37 PM

Did you specify a FixedPageAdorner behavior for your FixedPageViewer instances? The FixedPageAdorner behavior renders and manages the actual selection. Something like this is required in your template;

<doc:FixedPageViewer FixedPage="{Binding FixedPage}" 
  FixedPageSize="{Binding FixedPageSize}"
  FixedPageError="{Binding FixedPageError}"
  Scale="{Binding DesiredPageScale}">
        <doc:FixedPageAdorner Annotations="{Binding TextContainer.Annotations}" Selection="{Binding TextContainer.Selection}" />
        <doc:NavigationBehavior TextContainer="{Binding TextContainer}" />

- koen

Dec 8, 2011 at 2:56 PM
Edited Dec 8, 2011 at 2:57 PM

That's right, i forgot FixePageAdorner and now i can use text mode with the template. Thank you once more kozw for all !