Table of Contents

Class Panel

Namespace
Avalonia.Controls
Assembly
Avalonia.Controls.dll

Base class for controls that can contain multiple children.

public class Panel : Control, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, IChildIndexProvider
Inheritance
Panel
Implements
Derived
Inherited Members
Extension Methods

Remarks

Controls can be added to a Panel by adding them to its Children collection. All children are layed out to fill the panel.

Constructors

Panel()

Initializes a new instance of the Panel class.

public Panel()

Fields

BackgroundProperty

Defines the Background property.

public static readonly StyledProperty<IBrush?> BackgroundProperty

Field Value

StyledProperty<IBrush>

Properties

Background

Gets or Sets Panel background brush.

public IBrush? Background { get; set; }

Property Value

IBrush

Children

Gets the children of the Panel.

[Content]
public Controls Children { get; }

Property Value

Controls

IsItemsHost

Gets whether the Panel hosts the items created by an ItemsPresenter.

public bool IsItemsHost { get; }

Property Value

bool

Methods

AffectsParentArrange<TPanel>(params AvaloniaProperty[])

Marks a property on a child as affecting the parent panel's arrangement.

protected static void AffectsParentArrange<TPanel>(params AvaloniaProperty[] properties) where TPanel : Panel

Parameters

properties AvaloniaProperty[]

The properties.

Type Parameters

TPanel

AffectsParentMeasure<TPanel>(params AvaloniaProperty[])

Marks a property on a child as affecting the parent panel's measurement.

protected static void AffectsParentMeasure<TPanel>(params AvaloniaProperty[] properties) where TPanel : Panel

Parameters

properties AvaloniaProperty[]

The properties.

Type Parameters

TPanel

ChildrenChanged(object?, NotifyCollectionChangedEventArgs)

Called when the Children collection changes.

protected virtual void ChildrenChanged(object? sender, NotifyCollectionChangedEventArgs e)

Parameters

sender object

The event sender.

e NotifyCollectionChangedEventArgs

The event args.

Render(DrawingContext)

Renders the visual to a DrawingContext.

public override sealed void Render(DrawingContext context)

Parameters

context DrawingContext

The drawing context.