Style.Set
method · Style · cAlgo.API
DesktopCLICloud
Provides data for the chart control Style for the specified ControlProperty and the ControlState.
Overloads
| Signature | Description |
|---|---|
Set(ControlProperty property, object value, ControlState state) | Provides data for the chart control Style for the specified ControlProperty and the ControlState. |
Set(ControlProperty property, object value) | Sets the chart control Style for the specified ControlProperty. |
Set(ControlProperty property, object value, ControlState state)
Provides data for the chart control Style for the specified ControlProperty and the ControlState.
public void Set(ControlProperty property, object value, ControlState state)
style.Set(property: ControlProperty, value: object, state: ControlState) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
property | ControlProperty | ControlProperty | The control property |
value | object | object | The property value |
state | ControlState | ControlState | Control state |
Examples
var style = new Style();
style.Set(ControlProperty.BackgroundColor, Color.DarkGreen, ControlState.DarkTheme);
style.Set(ControlProperty.BackgroundColor, Color.LightGreen, ControlState.LightTheme);
style.Set(ControlProperty.BackgroundColor, Color.Gray, ControlState.Disabled);
Chart.AddControl(new Button { Text = "Buy", Style = style });
style = Style()
style.Set(ControlProperty.BackgroundColor, Color.DarkGreen, ControlState.DarkTheme)
style.Set(ControlProperty.BackgroundColor, Color.LightGreen, ControlState.LightTheme)
style.Set(ControlProperty.BackgroundColor, Color.Gray, ControlState.Disabled)
button = Button()
button.Text = "Buy"
button.Style = style
api.Chart.AddControl(button)
Set(ControlProperty property, object value)
Sets the chart control Style for the specified ControlProperty.
public void Set(ControlProperty property, object value)
style.Set(property: ControlProperty, value: object) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
property | ControlProperty | ControlProperty | The control property |
value | object | object | The property value |
Examples
var style = new Style();
style.Set(ControlProperty.ForegroundColor, Color.Gold);
style.Set(ControlProperty.FontWeight, FontWeight.Bold);
Chart.AddControl(new TextBlock { Text = "Daily target reached", Style = style });
style = Style()
style.Set(ControlProperty.ForegroundColor, Color.Gold)
style.Set(ControlProperty.FontWeight, FontWeight.Bold)
textBlock = TextBlock()
textBlock.Text = "Daily target reached"
textBlock.Style = style
api.Chart.AddControl(textBlock)