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

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

# Window (class)

The window class, you can use it to show a window that can contain other chart controls

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

- CLI: Never shown: Show, Hide and Close send nothing; IsVisible stays false and window events never fire.
- Cloud: Never shown: Show, Hide and Close send nothing; IsVisible stays false and window events never fire.

## Definition

```csharp
public sealed class Window
```

## Examples

C#:

```csharp
var panel = new StackPanel { Margin = 10 };
panel.AddChild(new TextBlock { Text = "Balance: " + Account.Balance });
var closeButton = new Button { Text = "Close", Margin = new Thickness(0, 10, 0, 0) };
panel.AddChild(closeButton);
var window = new Window
{
    Title = "Account summary",
    Width = 250,
    Height = 150,
    WindowStartupLocation = WindowStartupLocation.CenterOwner,
    Child = panel
};
closeButton.Click += args => window.Close();
window.Closed += args => Print("Window closed");
window.Show();
```

Python:

```python
panel = StackPanel()
balance = TextBlock()
balance.Text = f"Balance: {api.Account.Balance}"
panel.AddChild(balance)
closeButton = Button()
closeButton.Text = "Close"
panel.AddChild(closeButton)
window = Window()
window.Title = "Account summary"
window.Width = 250
window.Height = 150
window.WindowStartupLocation = WindowStartupLocation.CenterOwner
window.Child = panel
closeButton.Click += lambda args: window.Close()
window.Closed += lambda args: api.Print("Window closed")
window.Show()
```

## Constructors

- `public Window()` — Creates an empty window with default settings [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Constructor/index.md)

## Methods

- `public void Close()` — Closes the window [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Close/index.md)
- `public void Hide()` — Hides the window [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Hide/index.md)
- `public void Show()` — Shows the window [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Show/index.md)

## Properties

- `public Color BackgroundColor {get; set;}` — Get / Set the window background color [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/BackgroundColor/index.md)
- `public ControlBase Child {get; set;}` — Get / Set the main content control of window [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Child/index.md)
- `public double Height {get; set;}` — Get / Set height of the Window [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Height/index.md)
- `public bool IsActive {get;}` — Get / Set the window active / de-active flag, if Yes then the window will be active [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/IsActive/index.md)
- `public bool IsVisible {get;}` — Get / Set the window visibility flag, if Yes then the window will be shown otherwise it will be hidden [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/IsVisible/index.md)
- `public double Left {get; set;}` — Get / Set window left margin (X) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Left/index.md)
- `public double MaxHeight {get; set;}` — Get / Set the window maximum height [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/MaxHeight/index.md)
- `public double MaxWidth {get; set;}` — Get / Set the window maximum width [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/MaxWidth/index.md)
- `public double MinHeight {get; set;}` — Get / Set the window minimum height [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/MinHeight/index.md)
- `public double MinWidth {get; set;}` — Get / Set the window minimum width [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/MinWidth/index.md)
- `public OwnerType OwnerType {get; set;}` — Get / Set the window owner [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/OwnerType/index.md)
- `public Thickness Padding {get; set;}` — Get / Set the window padding [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Padding/index.md)
- `public ResizeMode ResizeMode {get; set;}` — Get / Set the window resize mode [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/ResizeMode/index.md)
- `public string Title {get; set;}` — Get / Set the window title [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Title/index.md)
- `public double Top {get; set;}` — Get / Set window top margin (Y) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Top/index.md)
- `public bool Topmost {get; set;}` — Get / Set the window topmost flag, if True then the window will appear on top of all other windows [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Topmost/index.md)
- `public double Width {get; set;}` — Get / Set width of the window [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Width/index.md)
- `public WindowStartupLocation WindowStartupLocation {get; set;}` — Get / Set the window startup location [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/WindowStartupLocation/index.md)
- `public WindowState WindowState {get; set;}` — Get / Set the window state [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/WindowState/index.md)

## Events

- `public event Action<WindowActivatedEventArgs> Activated;` — This event gets triggered when window is activated [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Activated/index.md)
- `public event Action<WindowClosedEventArgs> Closed;` — This event gets triggered when window is closed [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Closed/index.md)
- `public event Action<WindowDeactivatedEventArgs> Deactivated;` — This event gets triggered when window is deactivated [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Deactivated/index.md)
- `public event Action<WindowIsVisibleChangedEventArgs> IsVisibleChanged;` — This event gets triggered when window visibility changes [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/IsVisibleChanged/index.md)
- `public event Action<WindowLocationChangedEventArgs> LocationChanged;` — This event gets triggered when window location changes [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/LocationChanged/index.md)
- `public event Action<WindowSizeChangedEventArgs> SizeChanged;` — This event gets triggered when window is size changes [details](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/SizeChanged/index.md)

