> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/gum/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/gum/code/events-and-interactivity/scrolling.md).

# Scrolling

## Introduction

Gum includes controls which have built-in scrolling support. These are:

* `ListBox`
* `ItemsControl`
* `ScrollViewer`

Both `ListBox` and `ItemsControl` inherit from `ScrollViewer`, so many of the properties for scrolling are the same across all controls.

## Built-In Scrolling Behavior

All controls support the following built-in actions for scrolling:

* Mouse/touch screen interactions with scroll bars
* Mouse wheel scrolling
* Touch screen swipe scrolling

## Scrolling Speed

Scrolling speed is controlled by the following two variables:

* `SmallChange` - The amount to scroll when a scroll bar button is clicked, or when a *tick* is scrolled on the mouse wheel
* `LargeChange` - The amount to scroll when the user clicks on the scroll bar track

The following code creates two `ListBoxes` to compare the scrolling speed of each.

```csharp
// Initialize
var defaultListBox = new ListBox();
defaultListBox.AddToRoot();
defaultListBox.Anchor(Anchor.Center);
defaultListBox.X = -100;
for (int i = 0; i < 20; i++)
{
    defaultListBox.Items.Add(i);
}

var fastListBox = new ListBox();
fastListBox.AddToRoot();
fastListBox.Anchor(Anchor.Center);
fastListBox.X = 100;
// default is 10:
fastListBox.SmallChange = 50;
for (int i = 0; i < 20; i++)
{
    fastListBox.Items.Add(i);
}
```

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-de18550aaaa4f3d86d21224e3f826f5832a7d09a%2F24_21%2036%2030.gif?alt=media" alt=""><figcaption><p>Two ListBoxes with different SmallChange values</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/gum/code/events-and-interactivity/scrolling.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
