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 ContentSize, or ContentSize 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 ContentSize.

Remarks

Positive values for the location indicate the visible area is offset into (down-and-right) the View's virtual ContentSize. 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 ContentSize. 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.

If LayoutStyle is Computed the value of Viewport is indeterminate until the view has been initialized ( IsInitialized is true) and LayoutSubviews() has been called.

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 LayoutSubview(View, Size) and OnDrawContent(Rectangle) methods to be called.