---
id: "T:cAlgo.API.ControlProperty"
kind: "enum"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/Styles/ControlProperty/"
---

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

# ControlProperty (enum)

Represents the Control property enumeration used in Style to get or set a style for a specific property.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public enum ControlProperty
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use ControlProperty in control style
    public partial class ControlPropertySample : Indicator
    {
        protected override void Initialize()
        {
            var style = new Style();

            style.Set(ControlProperty.Margin, 5);
            style.Set(ControlProperty.ForegroundColor, Color.Blue);
            style.Set(ControlProperty.FontSize, 14);
            style.Set(ControlProperty.Width, 100);

            var textBlock = new TextBlock
            {
                Text = "Styled Text Block",
                Style = style,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center
            };

            Chart.AddControl(textBlock);
        }

        public override void Calculate(int index)
        {
        }
    }
}
```

Python:

```python
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        style = Style()
        style.Set(ControlProperty.Margin, 5)
        style.Set(ControlProperty.ForegroundColor, Color.Blue)
        style.Set(ControlProperty.FontSize, 14)
        style.Set(ControlProperty.Width, 100)

        textBlock = TextBlock()
        textBlock.Text = "Styled Text Block"
        textBlock.Style = style
        textBlock.HorizontalAlignment = HorizontalAlignment.Center
        textBlock.VerticalAlignment = VerticalAlignment.Center

        api.Chart.AddControl(textBlock)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}
```

## Values

- `ControlProperty.BackgroundColor` — The background color. Property value can be set using color values, or use the strings Color.Red, Color.FromName("Red"), Color.FromArgb(255, 0, 0), Color.FromHex("#ff0000"), "Red", "#ff0000".
- `ControlProperty.ForegroundColor` — The foreground color. Property value can be set using color values, or use the strings Color.Red, Color.FromName("Red"), Color.FromArgb(255, 0, 0), Color.FromHex("#ff0000"), "Red", "#ff0000".
- `ControlProperty.Opacity` — The opacity of the control. Can be set from 0 (transparent) to 1 (opaque). Values higher than 1 will be set to 1, values below 0 will be set to 0.
- `ControlProperty.MinWidth` — The minimum width of the control.
- `ControlProperty.MaxWidth` — The maximum width of the control.
- `ControlProperty.MinHeight` — The minimum hight of the control.
- `ControlProperty.MaxHeight` — The maximum hight of the control.
- `ControlProperty.Width` — The width of the control.
- `ControlProperty.Height` — The height of the control.
- `ControlProperty.Padding` — The padding of the control. Property value can be set using Thickness, number, or a string new Thickness(5), new Thickness(1, 2, 3, 4), 5, "5", "1 2 3 4".
- `ControlProperty.BorderThickness` — The thickness of the border of the control. Property value can be set using Thickness, number, or a string new Thickness(5), new Thickness(1, 2, 3, 4), 5, "5", "1 2 3 4".
- `ControlProperty.CornerRadius` — The radius of the corner of the control. Property value can be set using CornerRadius, number, or a string: new CornerRadius(5), new CornerRadius(1, 2, 3, 4).
- `ControlProperty.HorizontalContentAlignment` — The horizontal content alignment.
- `ControlProperty.VerticalContentAlignment` — The vertical content alignment.
- `ControlProperty.TextAlignment` — The alignment of the content.
- `ControlProperty.Margin` — The margin of the content. Property value can be set using Thickness, number, or a string new Thickness(5), new Thickness(1, 2, 3, 4), 5, "5", "1 2 3 4".
- `ControlProperty.FontWeight` — The content font weight. Property value can be set using the FontWeight enumerations: FontWeight.Bold, FontWeight.SemiBold, FontWeight.Light, FontWeight.Thin, etc.
- `ControlProperty.FontStyle` — The content font style. Property value can be set using the FontStyle enumeration: FontWeight.Italic or FontWeight.Oblique.
- `ControlProperty.FontFamily` — The font family.
- `ControlProperty.FontSize` — The font size.
- `ControlProperty.BorderColor` — The border color. Property value can be set using color values, or use the strings Color.Red, Color.FromName("Red"), Color.FromArgb(255, 0, 0), Color.FromHex("#ff0000"), "Red", "#ff0000".
- `ControlProperty.CaretColor` — The caret color. Property value can be set using color values, or use the strings Color.Red, Color.FromName("Red"), Color.FromArgb(255, 0, 0), Color.FromHex("#ff0000"), "Red", "#ff0000".

