Table of Contents

Property Viewport

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Viewport

Gets or sets the rectangle describing the portion of the View's content that is visible to the user. The viewport Location is relative to the top-left corner of the inner rectangle of Padding. If the viewport Size is the same as GetContentSize(), or GetContentSize() is null the Location will be 0, 0.

public virtual Rectangle Viewport { get; set; }

Property Value

Rectangle

The rectangle describing the location and size of the viewport into the View's virtual content, described by GetContentSize().

Remarks

See the View Layout Deep Dive for more information: https://gui-cs.github.io/Terminal.GuiV2Docs/docs/layout.html

Positive values for the location indicate the visible area is offset into (down-and-right) the View's virtual GetContentSize(). This enables scrolling down and to the right (e.g. in a ListView .

Negative values for the location indicate the visible area is offset above (up-and-left) the View's virtual GetContentSize(). This enables scrolling up and to the left (e.g. in an image viewer that supports zoom where the image stays centered).

The ViewportSettings property controls how scrolling is handled.

Updates to the Viewport Size updates Frame, and has the same impact as updating the Frame.

Altering the Viewport Size will eventually (when the view is next laid out) cause the Layout() and OnDrawingContent() methods to be called.