Table of Contents

Event ContentSizeChanging

Namespace
Terminal.Gui.ViewBase
Assembly
Terminal.Gui.dll

Raised before the content size changes, allowing handlers to modify or cancel the change.

public event EventHandler<ValueChangingEventArgs<Size?>>? ContentSizeChanging

Returns

EventHandler<ValueChangingEventArgs<Size?>>
Raised before the content size changes, allowing handlers to modify or cancel the change.

Examples

view.ContentSizeChanging += (sender, args) =>
{
    if (args.NewValue?.Width > 1000)
    {
        args.Handled = true;
        Console.WriteLine("Content size too large, change cancelled.");
    }
};

Remarks

Set Handled to true to cancel the change or modify NewValue to adjust the proposed value.

This event follows the Cancellable Work Pattern (CWP). See the CWP Deep Dive for more information.