---
id: "T:cAlgo.API.Panel"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Panel/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Panel (class)

Provides a base class for all Panel elements. Use Panel elements to position and arrange child objects.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Accepted without error but never displayed, so control events such as Click are never raised.
- Cloud: Accepted without error but never displayed, so control events such as Click are never raised.

## Definition

```csharp
public abstract class Panel : ControlBase
```

## Examples

C#:

```csharp
Panel panel = new StackPanel { BackgroundColor = Color.FromArgb(80, Color.Black), Margin = 10 };
panel.AddChild(new TextBlock { Text = SymbolName });
panel.AddChild(new TextBlock { Text = "Spread: " + Symbol.Spread / Symbol.PipSize });
Chart.AddControl(panel);
Print("Panel children: {0}", panel.ChildCount);
```

Python:

```python
panel = StackPanel()
panel.BackgroundColor = Color.FromArgb(80, Color.Black)
symbolText = TextBlock()
symbolText.Text = api.SymbolName
spreadText = TextBlock()
spreadText.Text = f"Spread: {api.Symbol.Spread / api.Symbol.PipSize}"
panel.AddChild(symbolText)
panel.AddChild(spreadText)
api.Chart.AddControl(panel)
api.Print(f"Panel children: {panel.ChildCount}")
```

## Methods

- `public void AddChild(ControlBase child)` — Adds the child element. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Panel/AddChild/index.md)
- `public bool HasChild(ControlBase child)` — Returns True if panel has passed child otherwise false. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Panel/HasChild/index.md)
- `public void RemoveChild(ControlBase child)` — Removes the child element. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Panel/RemoveChild/index.md)

## Properties

- `public Color BackgroundColor {get; set;}` — Gets or sets the color of the panel background. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Panel/BackgroundColor/index.md)
- `public int ChildCount {get;}` — Gets count of panel children. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Panel/ChildCount/index.md)
- `public IEnumerable<ControlBase> Children {get;}` — Gets panel children. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Panel/Children/index.md)

## Inherited members

- `public void ResetProperty(ControlProperty property)` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/ResetProperty/index.md)
- `public Guid UniqueId {get;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/UniqueId/index.md)
- `public Style Style {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Style/index.md)
- `public double Left {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Left/index.md)
- `public double Top {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Top/index.md)
- `public double Right {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Right/index.md)
- `public double Bottom {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Bottom/index.md)
- `public double Width {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Width/index.md)
- `public double Height {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Height/index.md)
- `public double MinWidth {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MinWidth/index.md)
- `public double MinHeight {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MinHeight/index.md)
- `public double MaxWidth {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MaxWidth/index.md)
- `public double MaxHeight {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MaxHeight/index.md)
- `public bool IsEnabled {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsEnabled/index.md)
- `public bool IsVisible {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsVisible/index.md)
- `public double Opacity {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Opacity/index.md)
- `public Thickness Margin {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Margin/index.md)
- `public VerticalAlignment VerticalAlignment {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/VerticalAlignment/index.md)
- `public HorizontalAlignment HorizontalAlignment {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/HorizontalAlignment/index.md)
- `public Dock Dock {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Dock/index.md)
- `public bool IsHitTestVisible {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsHitTestVisible/index.md)

