Skip to content

Window

class cAlgo.API

DesktopCLICloud

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

Environment behaviour

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

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

Definition

public sealed class Window

Namespace: cAlgo.API · Group: Windows

Examples

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();
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

Name Description
WindowDesktopCLICloud Creates an empty window with default settings

Methods

Name Description
CloseDesktopCLICloudvoid Closes the window
HideDesktopCLICloudvoid Hides the window
ShowDesktopCLICloudvoid Shows the window

Properties

Name Description
BackgroundColorDesktopCLICloudColor Get / Set the window background color
ChildDesktopCLICloudControlBase Get / Set the main content control of window
HeightDesktopCLIClouddouble Get / Set height of the Window
IsActiveDesktopCLICloudbool Get / Set the window active / de-active flag, if Yes then the window will be active
IsVisibleDesktopCLICloudbool Get / Set the window visibility flag, if Yes then the window will be shown otherwise it will be hidden
LeftDesktopCLIClouddouble Get / Set window left margin (X)
MaxHeightDesktopCLIClouddouble Get / Set the window maximum height
MaxWidthDesktopCLIClouddouble Get / Set the window maximum width
MinHeightDesktopCLIClouddouble Get / Set the window minimum height
MinWidthDesktopCLIClouddouble Get / Set the window minimum width
OwnerTypeDesktopCLICloudOwnerType Get / Set the window owner
PaddingDesktopCLICloudThickness Get / Set the window padding
ResizeModeDesktopCLICloudResizeMode Get / Set the window resize mode
TitleDesktopCLICloudstring Get / Set the window title
TopDesktopCLIClouddouble Get / Set window top margin (Y)
TopmostDesktopCLICloudbool Get / Set the window topmost flag, if True then the window will appear on top of all other windows
WidthDesktopCLIClouddouble Get / Set width of the window
WindowStartupLocationDesktopCLICloudWindowStartupLocation Get / Set the window startup location
WindowStateDesktopCLICloudWindowState Get / Set the window state

Events

Name Description
ActivatedDesktopCLICloudAction<WindowActivatedEventArgs> This event gets triggered when window is activated
ClosedDesktopCLICloudAction<WindowClosedEventArgs> This event gets triggered when window is closed
DeactivatedDesktopCLICloudAction<WindowDeactivatedEventArgs> This event gets triggered when window is deactivated
IsVisibleChangedDesktopCLICloudAction<WindowIsVisibleChangedEventArgs> This event gets triggered when window visibility changes
LocationChangedDesktopCLICloudAction<WindowLocationChangedEventArgs> This event gets triggered when window location changes
SizeChangedDesktopCLICloudAction<WindowSizeChangedEventArgs> This event gets triggered when window is size changes