Skip to content

ControlProperty

Summary

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

Signature

1
public enum ControlProperty

Namespace

cAlgo.API

Fields

Name Description
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".
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".
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.
MinWidth The minimum width of the control.
MaxWidth The maximum width of the control.
MinHeight The minimum hight of the control.
MaxHeight The maximum hight of the control.
Width The width of the control.
Height The height of the control.
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".
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".
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).
HorizontalContentAlignment The horizontal content alignment.
VerticalContentAlignment The vertical content alignment.
TextAlignment The alignment of the content.
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".
FontWeight The content font weight. Property value can be set using the FontWeight enumerations: FontWeight.Bold, FontWeight.SemiBold, FontWeight.Light, FontWeight.Thin, etc.
FontStyle The content font style. Property value can be set using the FontStyle enumeration: FontWeight.Italic or FontWeight.Oblique.
FontFamily The font family.
FontSize The font size.
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".
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".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample shows how to use ControlProperty in control style
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public 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)
         {
         }
     }
 }

See Also


Last update: July 1, 2022

Comments