How do you hide a WPF DocumentViewer's menu bars?

前端 未结 2 496
一生所求
一生所求 2020-12-15 01:38

At the moment I have a DocumentViewer in a WPF window that displays an XPS file. I have created my own \"Next Page\" and \"Previous Page\" buttons and have set

2条回答
  •  Happy的楠姐
    2020-12-15 02:17

    To remove the toolbar you have to change the DocumentViewer's control template.

    Start with the template in this link http://msdn.microsoft.com/en-us/library/aa970452.aspx and remove the ToolBar element (and maybe also the ContentControl with x:Name="PART_FindToolBarHost" at the bottom).

    About setting the zoom, I don't have an elegant XAML solution, but you can call the DocumentViewer's FitToWidth or FitToHeight methods after you load the document (and every page if you must, you already have your own next/prev page code that can call those methods)

提交回复
热议问题