Skip to content

ScrollViewer

Summary

Represents a scrollable area that can contain other visible elements.

Signature

1
public class ScrollViewer : Control

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
47
48
49
50
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample indicator shows how to create a scrollable chart controls container via ScrollViewer control
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class ScrollViewerSample : Indicator
     {
         protected override void Initialize()
         {
             var scrollViewer = new ScrollViewer
             {
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 BackgroundColor = Color.Gold,
                 Opacity = 0.7,
                 HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                 VerticalScrollBarVisibility = ScrollBarVisibility.Visible,
                 Height = 100
             };
             var grid = new Grid(10, 2)
             {
                 BackgroundColor = Color.Gold,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
             };
             scrollViewer.Content = grid;
             for (int iRow = 0; iRow < 10; iRow++)
             {
                 grid.AddChild(new TextBlock
                 {
                     Text = "Text",
                     Margin = 5,
                     ForegroundColor = Color.Black,
                     FontWeight = FontWeight.ExtraBold
                 }, iRow, 0);
                 grid.AddChild(new Button
                 {
                     Text = "Button",
                     Margin = 5,
                     ForegroundColor = Color.Black,
                     FontWeight = FontWeight.ExtraBold
                 }, iRow, 1);
             }
             Chart.AddControl(scrollViewer);
         }
         public override void Calculate(int index)
         {
         }
     }
 }
 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
 import clr
 clr.AddReference("cAlgo.API")
 from cAlgo.API import *
 class Test():
     def initialize(self):
         scrollViewer = ScrollViewer()
         scrollViewer.HorizontalAlignment = HorizontalAlignment.Center
         scrollViewer.VerticalAlignment = VerticalAlignment.Center
         scrollViewer.BackgroundColor = Color.Gold
         scrollViewer.Opacity = 0.7
         scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto
         scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible
         scrollViewer.Height = 100
         grid = Grid(10, 2)
         grid.BackgroundColor = Color.Gold
         grid.HorizontalAlignment = HorizontalAlignment.Center
         grid.VerticalAlignment = VerticalAlignment.Center
         scrollViewer.Content = grid
         for iRow in range(10):
             textBlock = TextBlock()
             textBlock.Text = "Text"
             textBlock.Margin = Thickness(5)
             textBlock.ForegroundColor = Color.Black
             textBlock.FontWeight = FontWeight.ExtraBold
             grid.AddChild(textBlock, iRow, 0)
             button = Button()
             button.Text = "Button"
             button.Margin = Thickness(5)
             button.ForegroundColor = Color.Black
             button.FontWeight = FontWeight.ExtraBold
             grid.AddChild(button, iRow, 1)
         api.Chart.AddControl(scrollViewer)

Properties

HorizontalScrollBarVisibility

Summary

Defines the horizontal scroll bar visibility.

Signature

1
public ScrollBarVisibility HorizontalScrollBarVisibility {get; set;}

Return Value

ScrollBarVisibility

VerticalScrollBarVisibility

Summary

Defines the vertical scroll bar visibility.

Signature

1
public ScrollBarVisibility VerticalScrollBarVisibility {get; set;}

Return Value

ScrollBarVisibility

Content

Summary

Gets or sets the content.

Signature

1
public ControlBase Content {get; set;}

Return Value

ControlBase