Remove navigation buttons that appear when mousing over PDFViewCtrl in PDFNet for Windows Store Apps

62 views
Skip to first unread message

Tomas Hofmann

unread,
Jan 26, 2015, 8:06:23 PM1/26/15
to pdfne...@googlegroups.com
Q: When using PDFNet for Windows Store apps, one thing I'd like to do is hide the page navigation buttons that appear when mousing over the content in any of the non-continuous view layouts.
Alternatively, I'd like to re-style them so that they look like I want them to. How can I do this?

A: When you call PDFViewCtrl.SetScrollingEnabled(false) then those buttons will go away. Of course, scrolling won't work either, so this only works if you want to freeze the content temporarily.

A more permanent solution is to change the implicit style for FlipViews inside the hosting control.
The PDFViewCtrl uses a FlipView in order to handle page flipping in non-continuous modes.
This means that if you edit the Xaml style for FlipView, it will be reflected inside the PDFViewCtrl. You can always create a hosting control in which you put the FlipView and change the implicit style for that control only, if you don't want to use the same style for all other FlipViews. This lets you either hide the navigation buttons completely, or re-style them.
So, you could do something like this:
<Grid>
    <Grid.Resources>
<Style TargetType="FlipView">
...
</Style>
</Grid.Resources>
<!-- Place PDFViewCtrl here -->
</Grid>

The style for FlipViews can be found here:

This style has 4 navigation buttons defined ( i.e.  <Button x:Name="PreviousButtonHorizontal"). You can put all 4 inside a grid with a collapsed visibility in order to hide them, or edit the content of the Button completely to make it appear differently.
Keep in mind that in order to hide the FlipView buttons when calling PDFViewCtrl.SetScrollingEnabled(false), the PDFViewCtrl must traverse the VisualTree of the internal FlipView, possible causing problems if the Template changes things around too much.

Tomas Hofmann

unread,
Jan 27, 2015, 5:17:40 PM1/27/15
to pdfne...@googlegroups.com
Note that you can use exactly the same technique to edit the appearance of ScrollBars. It will not be enough to only edit the ScrollViewer style, as we are using our own scrollbars in Continuous mode due to a bug in Windows with large content in a ScrollViewer. So editing the appearance of ScrollBars should take care of it.
Reply all
Reply to author
Forward
0 new messages