Skip to content

ScrollBarVisibility

enum cAlgo.API

DesktopCLICloud

Specifies the visibility of a ScrollBar for scrollable content.

Definition

public enum ScrollBarVisibility

Namespace: cAlgo.API · Group: ScrollViewer

Examples

using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use the ScrollBarVisibility
    public partial class ScrollBarVisibilitySample : Indicator
    {
        protected override void Initialize()
        {
            var scrollViewer = new ScrollViewer
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                BackgroundColor = Color.Gold,
                Opacity = 0.7,
                HorizontalScrollBarVisibility = HorizontalScrollBarVisibility,
                VerticalScrollBarVisibility = VerticalScrollBarVisibility,
                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)
        {
        }
    }
}
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def get_text_block(self, text):
        textBlock = TextBlock()
        textBlock.Text = text
        textBlock.FontWeight = FontWeight.ExtraBold
        textBlock.ForegroundColor = Color.Black
        textBlock.Margin = Thickness(5)
        return textBlock

    def initialize(self):
        scrollViewer = ScrollViewer()
        scrollViewer.HorizontalAlignment = HorizontalAlignment.Center
        scrollViewer.VerticalAlignment = VerticalAlignment.Center
        scrollViewer.BackgroundColor = Color.Gold
        scrollViewer.Opacity = 0.7
        scrollViewer.HorizontalScrollBarVisibility = api.HorizontalScrollBarVisibility
        scrollViewer.VerticalScrollBarVisibility = api.VerticalScrollBarVisibility
        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):
            grid.AddChild(self.get_text_block("Text"), 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)
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true,
  "Parameters": [
    {
      "Name": "HorizontalScrollBarVisibility",
      "DisplayName": "Horizontal Scroll Bar Visibility",
      "Type": "Enum",
      "EnumTypeFullName": "cAlgo.API.ScrollBarVisibility",
      "DefaultValue": "Auto"
    },
    {
      "Name": "VerticalScrollBarVisibility",
      "DisplayName": "Vertical Scroll Bar Visibility",
      "Type": "Enum",
      "EnumTypeFullName": "cAlgo.API.ScrollBarVisibility",
      "DefaultValue": "Visible"
    }
  ]
}

Values

Name Value Description
Disabled 0 A ScrollBar does not appear even when the viewport cannot display all of the content.
Auto 1 A ScrollBar appears and the dimension of the ScrollViewer is applied to the content when the viewport cannot display all of the content.
Hidden 2 A ScrollBar does not appear even when the viewport cannot display all of the content. The dimension of the ScrollViewer is not applied to the content.
Visible 3 A ScrollBar always appears. The dimension of the ScrollViewer is applied to the content.

See also