CheckBox


Summary

Represents the Checkbox.

Syntax

public class CheckBox : Control

Members

NameTypeSummary
CheckBox MethodInitializes a new instance of the checkbox class.
Checked EventOccurs when checked.
Click EventOccurs when clicked.
Content PropertyGets or sets the content.
Indeterminate EventOccurs when indeterminate.
IsChecked PropertyGets or sets a value indicating whether the checkbox is checked.
IsThreeState PropertyChecks if the checkbox may be of three states - checked, unchecked and indeterminate.
Text PropertyGets or sets the checkbox text.
Unchecked EventOccurs when unchecked.

Example 1

using cAlgo.API;
namespace cAlgo
{
    // This sample shows how to use checkbox control and handle its checked/unchecked events
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CheckBoxControlSample : Indicator
    {
        protected override void Initialize()
        {
            var stackPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                BackgroundColor = Color.Gold
            };
            var checkBox = new CheckBox
            {
                Text = "Unchecked",
                Margin = 10,
                FontWeight = FontWeight.ExtraBold
            };
            checkBox.Checked += CheckBox_Checked;
            checkBox.Unchecked += CheckBox_Unchecked;
            stackPanel.AddChild(checkBox);
            Chart.AddControl(stackPanel);
        }
        private void CheckBox_Unchecked(CheckBoxEventArgs obj)
        {
            obj.CheckBox.Text = "Unchecked";
        }
        private void CheckBox_Checked(CheckBoxEventArgs obj)
        {
            obj.CheckBox.Text = "Checked";
        }
        public override void Calculate(int index)
        {
        }
    }
}
Reference