---
id: "M:cAlgo.API.Panel.AddChild(cAlgo.API.ControlBase)"
kind: "method"
type: "T:cAlgo.API.Panel"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Panel/AddChild/"
---

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

# Panel.AddChild

Member of [Panel](https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Panel/index.md).

## AddChild(ControlBase child)

Adds the child element.

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.

C#:

```csharp
public void AddChild(ControlBase child)
```

Python:

```python
panel.AddChild(child: ControlBase) -> None
```

### Parameters

- `child` (`ControlBase`, Python `ControlBase`): The child.

### Examples

C#:

```csharp
var panel = new StackPanel { Orientation = Orientation.Horizontal };
var buyButton = new Button { Text = "Buy" };
buyButton.Click += args => ExecuteMarketOrder(TradeType.Buy, SymbolName, Symbol.QuantityToVolumeInUnits(0.01));
panel.AddChild(buyButton);
Chart.AddControl(panel);
```

Python:

```python
panel = StackPanel()
panel.Orientation = Orientation.Horizontal
buyButton = Button()
buyButton.Text = "Buy"
buyButton.Click += lambda args: api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, api.Symbol.QuantityToVolumeInUnits(0.01))
panel.AddChild(buyButton)
api.Chart.AddControl(panel)
```

