How to hide vertical PDFViewWPF scrollbar in version 6.2.1.23937?

55 views
Skip to first unread message

Luděk Rous

unread,
May 30, 2014, 9:24:42 AM5/30/14
to pdfne...@googlegroups.com
How to hide vertical PDFViewWPF scrollbar in version 6.2.1.23937?

In XAML
<PDFTron:PDFViewWPF x:Name="pdfView" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"> does not work.

Thanks

Tomas Hofmann

unread,
Jun 5, 2014, 7:36:03 PM6/5/14
to pdfne...@googlegroups.com
Hi Luděk,

Currently, we haven't added support for those types of properties. We will add this for future releases.
In the meantime, you can remove them by travelling through the UI tree and finding them.

The following function will hide the ScrollBars for the current Canvas (i.e everything in a continuous mode, or the current pages visible in you are in one of the non continues page presentation modes.).

private void HideScrollBars()
{
Object o = Current_View.Content;
Grid mainGrid = o as Grid;
if (mainGrid != null)
{
foreach (object chld in mainGrid.Children)
{
ScrollViewer sv = chld as ScrollViewer;
if (sv != null)
{
sv.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
sv.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
}
}
}
}

If in a non continues page presentation mode, this will have to be called after the page has changed. Although this has to be done using the UI dispatcher, so that it happens just after the new ScrollViewer has taken the place of the old on. That is:

void PDFViewWPF_CurrentPageNumberChanged(PDFViewWPF viewer, int currentPage, int totalPages)
{
Current_Main.txtbox_pagenum.Text = currentPage.ToString();
this.Dispatcher.BeginInvoke((System.Action)delegate
{
HideScrollBars();
});
}

Furthermore, you will have to call this HideScrollBars function every time the user changes the page presentation mode, and some other things, such as resizing the control. I recommend testing the app and making sure they always stay hidden. There are several events from the PDFViewWPF which should cover these scenarious.

Best Regards,
Tomas Hofamnn

Luděk Rous

unread,
Jun 10, 2014, 2:00:20 AM6/10/14
to pdfne...@googlegroups.com
Thanks a lot Tomas,
everything works fine.

Best Regards,
Luděk Rous
Reply all
Reply to author
Forward
0 new messages