Skip to content

ToggleButtonEventArgs

Summary

Represents the toggle button event class.

Signature

1
public class ToggleButtonEventArgs

Namespace

cAlgo.API

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 using cAlgo.API;
 using System;
 using System.Linq;
 namespace cAlgo
 {
     // This sample indicator shows how to use ToggleButtonEventArgs
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class ToggleButtonEventArgsSample : Indicator
     {
         protected override void Initialize()
         {
             var stackPanel = new StackPanel
             {
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 BackgroundColor = Color.Gold,
                 Opacity = 0.7
             };
             for (int i = 0; i < 5; i++)
             {
                 var toggleButton = new ToggleButton
                 {
                     Text = "Toggle Button #" + i + " Unchecked",
                     Margin = 10
                 };
                 toggleButton.Checked += ToggleButton_Checked;
                 toggleButton.Unchecked += ToggleButton_Unchecked;
                 stackPanel.AddChild(toggleButton);
             }
             Chart.AddControl(stackPanel);
         }
         private void ToggleButton_Checked(ToggleButtonEventArgs obj)
         {
             var textSplit = obj.ToggleButton.Text.Split(' ').TakeWhile(text => !text.Equals("Unchecked", StringComparison.OrdinalIgnoreCase)).ToArray();
             obj.ToggleButton.Text = string.Join(" ", textSplit) + " Checked";
         }
         private void ToggleButton_Unchecked(ToggleButtonEventArgs obj)
         {
             var textSplit = obj.ToggleButton.Text.Split(' ').TakeWhile(text => !text.Equals("Checked", StringComparison.OrdinalIgnoreCase)).ToArray();
             obj.ToggleButton.Text = string.Join(" ", textSplit) + " Unchecked";
         }
         public override void Calculate(int index)
         {
         }
     }
 }

See Also

Properties

ToggleButton

Summary

Gets the toggle button data.

Signature

1
public ToggleButton ToggleButton {get;}

Return Value

ToggleButton

Related Tutorials