2

How can I change the View Mode of DocumentViewer?, I want the page to be full width since the beginning.
If I use documentViewer.FitToWidth() it does stretch but not completely.
If I use ctrl+2 it stretches completely and thats what I want to achieve programmatically or using xaml if possible.

Thanks

Ron
  • 3,975
  • 17
  • 80
  • 130
  • I've not used this control, but I'm guessing you've already tried `HorizontalAlignment="Stretch"` ? – Mashton Jan 14 '14 at 09:04
  • @Mashton it stretches the control not the inner data inside – Ron Jan 14 '14 at 11:06
  • Oh ok. How about `HorizontalContentAlignment="Stretch"`? – Mashton Jan 14 '14 at 11:22
  • Can you explain what you mean by "stretches completely"? Looking at the code in Reflector, `FitToWidth()` just calls the handler of `FitToWidthCommand` (bound to Ctrl+2). – Dusan Jan 14 '14 at 16:40
  • @Dusan I found the problem. I used `FitToWidth()` too early (right after `documentViewer.Docuemnt = document`, I changed it - now I call it after the documentViewer loaded and it works fine.. I guess it was my fault - I dont understand why it stretches it almost completely when I call it right afther I load document but w/e as long as it works. – Ron Jan 14 '14 at 17:19
  • @Ron So does it mean you've solved your own problem? – 123 456 789 0 Jan 15 '14 at 18:47
  • @lll Yes. I cannot delete the question because of the bounty – Ron Jan 16 '14 at 16:01
  • 1
    @Ron if you have solved your own problem just post your solution as an answer and the bounty will just expire in 4 day... – nemesv Jan 16 '14 at 16:04

1 Answers1

3

I found the problem.

I used FitToWidth() too early (right after documentViewer.Docuemnt = document), I changed it - now I call it after the documentViewer loaded and it works fine.

I guess it was my fault - I dont understand why it stretches it almost completely when I call it right after I load document but w/e as long as it works.

Ron
  • 3,975
  • 17
  • 80
  • 130