For the complete documentation index, see llms.txt. This page is also available as Markdown.

PullToRefresh

PullToRefresh adds pull-to-refresh behavior to Wisej scrollable controls.

It lets you enable the feature per ScrollableControl, detects a downward pull only when the control is already at the top, shows a loader area while dragging, and raises a server-side Refresh event when the gesture completes. It also exposes a few appearance settings: BackColor, DropDownHeight, and ImageSource for the loader.

Operationally, it supports multiple target controls, delays registration until controls are created if needed, and cleans up its hooks when controls are disposed or when Clear() is called.

Code Example

Note that the PullToRefresh object here is private and readonly. This isn't strictly necessary-it could work if it were public. It is best practice to make pullToRefresh private readonly because it is an internal implementation detail of Page1, and the reference should be assigned once and not replaced later.

This code example creates a Panel with a solid border. Then, using this line of code: pullToRefresh.SetPullToRefresh(panel1, true); panel1 has PullToRefresh enabled and it is using the pullToRefresh1 object- so any properties of the pullToRefresh1 object that we set (ie BackColor) will show in panel1.

Next, we attach to the Refresh event and show an AlertBox. This AlertBox will display whenever the panel is refreshed. DropDownHeight is set to 100- this is the number of pixels that we can drag down the background when dragging to refresh. Finally, the BackColor is set to DarkGreen-this controls the color that we see when dragging down.

How To Use

The PullToRefresh extension can be added to a Wisej.NET project using NuGet Package Manager.

Last updated

Was this helpful?