Skip to content

TabControlSelectedTabChangedEventArgs

class cAlgo.API Since 5.2

DesktopCLICloud

Provides data for the TabControl SelectedTabChanged event.

Environment behaviour

CLI — not supported. Never raised in the CLI: the events that pass it never fire there (TabControl.SelectedTabChanged).

Cloud — not supported. Never raised in the cloud: the events that pass it never fire there (TabControl.SelectedTabChanged).

Definition

public class TabControlSelectedTabChangedEventArgs

Namespace: cAlgo.API · Group: EventArgs

Examples

protected override void OnStart()
{
    var tabControl = new TabControl();
    tabControl.AddTab(new TabItem { Header = new TextBlock { Text = "Positions" }, Content = new TextBlock { Text = "Open positions" } });
    tabControl.AddTab(new TabItem { Header = new TextBlock { Text = "Orders" }, Content = new TextBlock { Text = "Pending orders" } });
    tabControl.SelectedTabChanged += OnSelectedTabChanged;
    Chart.AddControl(tabControl);
}

private void OnSelectedTabChanged(TabControlSelectedTabChangedEventArgs args)
{
    var header = args.SelectedTab?.Header as TextBlock;
    Print("Selected tab: {0} of {1}", header?.Text, args.TabControl.Tabs.Count);
}
def on_start(self):
    tabControl = TabControl()
    for title in ["Positions", "Orders"]:
        header = TextBlock()
        header.Text = title
        tab = TabItem()
        tab.Header = header
        tabControl.AddTab(tab)
    tabControl.SelectedTabChanged += self.on_selected_tab_changed
    api.Chart.AddControl(tabControl)

def on_selected_tab_changed(self, args):
    api.Print(f"Selected tab: {args.SelectedTab.Header.Text} of {args.TabControl.Tabs.Count}")

Properties

Name Description
SelectedTabDesktopCLICloudTabItem Gets selected tab item.
TabControlDesktopCLICloudTabControl Gets tab control.

See also