---
id: "T:cAlgo.API.RadioButton"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/RadioButton/"
---

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

# RadioButton (class)

Reporesents the Radiobutton chart control type.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Accepted without error but never displayed, so control events such as Click are never raised.
- Cloud: Accepted without error but never displayed, so control events such as Click are never raised.

## Definition

```csharp
public class RadioButton : Control
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use the Radio button chart control
    public partial class RadioButtonSample : Indicator
    {
        protected override void Initialize()
        {
            var stackPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                BackgroundColor = Color.Gold,
                Opacity = 0.7
            };

            var firstRadioButton = new RadioButton
            {
                Text = "Unchecked"
            };

            firstRadioButton.Checked += RadioButton_Checked;
            firstRadioButton.Unchecked += RadioButton_Unchecked;

            stackPanel.AddChild(firstRadioButton);

            var secondRadioButton = new RadioButton
            {
                Text = "Unchecked"
            };

            secondRadioButton.Checked += RadioButton_Checked;
            secondRadioButton.Unchecked += RadioButton_Unchecked;

            stackPanel.AddChild(secondRadioButton);

            Chart.AddControl(stackPanel);
        }

        private void RadioButton_Unchecked(RadioButtonEventArgs obj)
        {
            var radioButton = obj.RadioButton;

            radioButton.Text = "Unchecked";
        }

        private void RadioButton_Checked(RadioButtonEventArgs obj)
        {
            var radioButton = obj.RadioButton;

            radioButton.Text = "Checked";
        }

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

Python:

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

from cAlgo.API import *

class Test():
    def initialize(self):
        stackPanel = StackPanel()
        stackPanel.HorizontalAlignment = HorizontalAlignment.Center
        stackPanel.VerticalAlignment = VerticalAlignment.Center
        stackPanel.BackgroundColor = Color.Gold
        stackPanel.Opacity = 0.7

        firstRadioButton = RadioButton()
        firstRadioButton.Text = "Unchecked"
        firstRadioButton.Checked += self.on_radio_button_checked
        firstRadioButton.Unchecked += self.on_radio_button_unchecked

        stackPanel.AddChild(firstRadioButton)

        secondRadioButton = RadioButton()
        secondRadioButton.Text = "Unchecked"
        secondRadioButton.Checked += self.on_radio_button_checked
        secondRadioButton.Unchecked += self.on_radio_button_unchecked

        stackPanel.AddChild(secondRadioButton)

        api.Chart.AddControl(stackPanel)

    def on_radio_button_checked(self, args):
        args.RadioButton.Text = "Checked"

    def on_radio_button_unchecked(self, args):
        args.RadioButton.Text = "Unchecked"
```

config.json:

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

## Constructors

- `public RadioButton()` — Initializes a new instance of the Radiobutton class. [details](https://help.ctrader.com/ctrader-algo/references/Controls/RadioButton/Constructor/index.md)

## Properties

- `public ControlBase Content {get; set;}` — Gets or sets the content. [details](https://help.ctrader.com/ctrader-algo/references/Controls/RadioButton/Content/index.md)
- `public string GroupName {get; set;}` — Gets or sets the name of the group. [details](https://help.ctrader.com/ctrader-algo/references/Controls/RadioButton/GroupName/index.md)
- `public bool IsChecked {get; set;}` — Defines if the radiobutton is checked. [details](https://help.ctrader.com/ctrader-algo/references/Controls/RadioButton/IsChecked/index.md)
- `public string Text {get; set;}` — Gets or sets the text. [details](https://help.ctrader.com/ctrader-algo/references/Controls/RadioButton/Text/index.md)

## Events

- `public event Action<RadioButtonEventArgs> Checked;` — Occurs when checked. [details](https://help.ctrader.com/ctrader-algo/references/Controls/RadioButton/Checked/index.md)
- `public event Action<RadioButtonEventArgs> Click;` — Occurs when clicked. [details](https://help.ctrader.com/ctrader-algo/references/Controls/RadioButton/Click/index.md)
- `public event Action<RadioButtonEventArgs> Unchecked;` — Occurs when unchecked. [details](https://help.ctrader.com/ctrader-algo/references/Controls/RadioButton/Unchecked/index.md)

## Inherited members

- `public Color ForegroundColor {get; set;}` (from Control) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/ForegroundColor/index.md)
- `public Color BackgroundColor {get; set;}` (from Control) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/BackgroundColor/index.md)
- `public Thickness Padding {get; set;}` (from Control) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/Padding/index.md)
- `public VerticalAlignment VerticalContentAlignment {get; set;}` (from Control) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/VerticalContentAlignment/index.md)
- `public HorizontalAlignment HorizontalContentAlignment {get; set;}` (from Control) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/HorizontalContentAlignment/index.md)
- `public FontWeight FontWeight {get; set;}` (from Control) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/FontWeight/index.md)
- `public FontStyle FontStyle {get; set;}` (from Control) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/FontStyle/index.md)
- `public string FontFamily {get; set;}` (from Control) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/FontFamily/index.md)
- `public double FontSize {get; set;}` (from Control) [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/FontSize/index.md)
- `public void ResetProperty(ControlProperty property)` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/ResetProperty/index.md)
- `public Guid UniqueId {get;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/UniqueId/index.md)
- `public Style Style {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Style/index.md)
- `public double Left {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Left/index.md)
- `public double Top {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Top/index.md)
- `public double Right {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Right/index.md)
- `public double Bottom {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Bottom/index.md)
- `public double Width {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Width/index.md)
- `public double Height {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Height/index.md)
- `public double MinWidth {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MinWidth/index.md)
- `public double MinHeight {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MinHeight/index.md)
- `public double MaxWidth {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MaxWidth/index.md)
- `public double MaxHeight {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MaxHeight/index.md)
- `public bool IsEnabled {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsEnabled/index.md)
- `public bool IsVisible {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsVisible/index.md)
- `public double Opacity {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Opacity/index.md)
- `public Thickness Margin {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Margin/index.md)
- `public VerticalAlignment VerticalAlignment {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/VerticalAlignment/index.md)
- `public HorizontalAlignment HorizontalAlignment {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/HorizontalAlignment/index.md)
- `public Dock Dock {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Dock/index.md)
- `public bool IsHitTestVisible {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsHitTestVisible/index.md)

