Skip to content

Commit 4d925e9

Browse files
authored
Merge pull request #3506 from syncfusion-content/UpdateMissingInfo
932478 - How to hide ScrollHead
2 parents e149091 + 22b17d7 commit 4d925e9

File tree

4 files changed

+36
-21
lines changed

4 files changed

+36
-21
lines changed
237 KB
Loading

MAUI/PDF-Viewer/Images/ScrollHead.png

25.2 KB
Loading

MAUI/PDF-Viewer/Scrolling.md

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
---
22
layout: post
33
title: Scrolling in .NET MAUI PDF Viewer Control | Syncfusion
4-
description: Learn here all about scrolling functionality in .NET MAUI PDF Viewer including programmatically setting scroll positions and detecting scroll changes.
4+
description: Explore scrolling features in .NET MAUI PDF Viewer, including how to set scroll positions programmatically and detect scroll changes in real time.
55
platform: MAUI
66
control: SfPdfViewer
77
documentation: ug
88
---
99

1010
# Scrolling in .NET MAUI PDF Viewer (SfPdfViewer)
1111

12-
The NET MAUI PDF Viewer has scrolling capabilities that allow users to navigate through content seamlessly. This section will walk you through various aspects of scrolling, including programmatically setting scroll positions and detecting scroll changes.
12+
The .NET MAUI PDF Viewer provides built-in scrolling capabilities that allow users to navigate through PDF content smoothly. This guide covers how to control scroll positions programmatically, detect scroll changes, and manage scroll-related UI elements.
1313

14-
W> Please note that since the PDF Viewer has built-in scrolling capability, it is advised to avoid placing the PDF Viewer inside other controls that also offer scrolling, such as [ScrollView](https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/scrollview?view=net-maui-8.0). Nesting within such controls may cause unexpected issues.
14+
W> Since the PDF Viewer includes built-in scrolling, avoid placing it inside other scrollable containers like [ScrollView](https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/scrollview?view=net-maui-8.0), as this may lead to unexpected behavior.
1515

16-
## Navigate to the desired offset programmatically
16+
## Programmatic Scrolling
1717

18-
The [ScrollToOffset](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_ScrollToOffset_System_Double_System_Double_) method moves the scroll position of the SfPdfViewer to the specified horizontal and vertical offsets. If the specified offset value is wrong, the scroll will not happen, and the older position will be retained. The offset values are represented in device-independent units.
18+
Use the [ScrollToOffset](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_ScrollToOffset_System_Double_System_Double_) method to scroll to a specific horizontal and vertical offset. Offset values are measured in **device-independent units**. If the specified offset is invalid or out of bounds, the scroll action will be ignored and the viewer will retain its current position.
1919

2020
{% tabs %}
2121
{% highlight c# %}
22-
// Navigate to the scroll offset position (100,1000).
22+
// Scroll to position (100, 1000)
2323
PdfViewer.ScrollToOffset(100, 1000);
2424
{% endhighlight %}
2525
{% endtabs %}
2626

27-
## Scroll changes detection
27+
## Detect Scroll Changes
2828

29-
The `PropertyChanged` event can be used to identify the scroll changes in the PDF Viewer effectively. By monitoring the [HorizontalOffset](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_HorizontalOffset) and [VerticalOffset](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_VerticalOffset) property changes, you can respond to both the horizontal and vertical scroll movements respectively.
29+
You can monitor scroll changes using the `PropertyChanged` event. By monitoring the [HorizontalOffset](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_HorizontalOffset) and [VerticalOffset](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_VerticalOffset) property changes, you can respond to both the horizontal and vertical scroll movements respectively.
3030

3131
The following is the code example for subscribing to the `PropertyChanged` event.
3232

@@ -49,7 +49,7 @@ void SubscribeToPropertyChangedEvent()
4949
{% endhighlight %}
5050
{% endtabs %}
5151

52-
Handle scroll changes by implementing the event handler method. The following code example illustrates how to respond to both horizontal and vertical scroll changes:
52+
The following code example illustrates how implement the event handler and to respond to both horizontal and vertical scroll changes:
5353

5454
{% tabs %}
5555
{% highlight c# %}
@@ -70,7 +70,7 @@ private void PdfViewer_PropertyChanged(object sender,
7070
{% endhighlight %}
7171
{% endtabs %}
7272

73-
## Detecting the end of the document
73+
## Detecting End of Document
7474

7575
You can determine if the control has reached the vertical end of the document by evaluating the following properties:
7676

@@ -109,5 +109,31 @@ private void PdfViewer_PropertyChanged(object sender,
109109
PdfViewer.ClientRectangle.Width >= PdfViewer.ExtentWidth);
110110
}
111111
}
112+
112113
{% endhighlight %}
113114
{% endtabs %}
115+
116+
## Scroll Head (Mobile Platforms)
117+
118+
On Android and iOS platforms, the scroll head offers a quick way to move through pages. Users can drag the thumb indicator to scroll within the PDF document.
119+
120+
![Scroll Head](Images\ScrollHead.png)
121+
122+
### Page Navigation via Scroll Head
123+
124+
Tap the scroll head to open a page navigation dialog. Enter a valid page number and tap **OK** to jump directly to that page.
125+
126+
![Page navigation by tapping scroll head](Images\PageNavigationUsingScrollHead.gif)
127+
128+
### Show or Hide the Scroll Head
129+
130+
Use the [ShowScrollHead](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_ShowScrollHead) property to control the visibility of the scroll head.
131+
132+
{% tabs %}
133+
{% highlight c# %}
134+
// Hide the scroll head thumb
135+
PdfViewer.ShowScrollHead = false;
136+
{% endhighlight %}
137+
{% endtabs %}
138+
139+
N> The scroll head is available only on **mobile platforms**. It is not supported on **Windows** or **macOS**.

MAUI/PDF-Viewer/UI-Customization.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ documentation: ug
1111

1212
This section walks you through the UI customization options supported in the [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html).
1313

14-
## Show or hide the scroll head
15-
16-
You can scroll through the pages by simply dragging the scroll head in the UI. The [SfPdfViewer](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html) allows you to show or hide the scroll head thumb displayed using the [ShowScrollHead](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.PdfViewer.SfPdfViewer.html#Syncfusion_Maui_PdfViewer_SfPdfViewer_ShowScrollHead) property. Refer to the following code example.
17-
18-
{% tabs %}
19-
{% highlight c# %}
20-
// Hide the scroll head thumb
21-
PdfViewer.ShowScrollHead = false;
22-
{% endhighlight %}
23-
{% endtabs %}
24-
2514
## Customize the loading indicator
2615

2716
You can customize the loading indicator’s properties by applying a style with the `TargetType` property to `ActivityIndicator`. You may also need to set the [ApplyToDerivedTypes](https://learn.microsoft.com/en-us/dotnet/maui/user-interface/styles/xaml?view=net-maui-7.0#apply-a-style-to-derived-types) property to `True` to get the style applied to the derived classes. See the following code example to customize the color of the loading indicator.

0 commit comments

Comments
 (0)