Style constructor
constructor · Style · cAlgo.API
DesktopCLICloud
Initializes a new instance of Style class.
Overloads
| Signature | Description |
|---|---|
Style() | Initializes a new instance of Style class. |
Style(Style parentStyle) | Represents the parent style to be inherited by a desired style. |
Style()
Initializes a new instance of Style class.
public Style()
Style()
Examples
var style = new Style();
style.Set(ControlProperty.FontSize, 14);
style.Set(ControlProperty.Margin, 5);
var panel = new StackPanel();
panel.AddChild(new TextBlock { Text = "Balance", Style = style });
panel.AddChild(new TextBlock { Text = "Equity", Style = style });
Chart.AddControl(panel);
style = Style()
style.Set(ControlProperty.FontSize, 14)
style.Set(ControlProperty.Margin, 5)
panel = StackPanel()
for text in ["Balance", "Equity"]:
textBlock = TextBlock()
textBlock.Text = text
textBlock.Style = style
panel.AddChild(textBlock)
api.Chart.AddControl(panel)
Style(Style parentStyle)
Represents the parent style to be inherited by a desired style.
public Style(Style parentStyle)
Style(parentStyle: Style)
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
parentStyle | Style | Style |
Examples
var baseStyle = new Style();
baseStyle.Set(ControlProperty.FontSize, 12);
var warningStyle = new Style(baseStyle);
warningStyle.Set(ControlProperty.ForegroundColor, Color.Red);
Chart.AddControl(new TextBlock { Text = "Margin level is low", Style = warningStyle });
baseStyle = Style()
baseStyle.Set(ControlProperty.FontSize, 12)
warningStyle = Style(baseStyle)
warningStyle.Set(ControlProperty.ForegroundColor, Color.Red)
textBlock = TextBlock()
textBlock.Text = "Margin level is low"
textBlock.Style = warningStyle
api.Chart.AddControl(textBlock)