Skip to content

LineStackingStrategy

Summary

Describes a mechanism by which a line box is determined for each line.

Signature

1
public enum LineStackingStrategy

Namespace

cAlgo.API

Fields

Name Description
BlockLineHeight The stack height is determined by the block element line-height property value.
MaxHeight The stack height is the smallest value that containing all the inline elements on that line when those elements are properly aligned.

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
 using cAlgo.API;
 using System.Text;
 namespace cAlgo
 {
     // This sample indicator shows how to use different Line Stacking Strategies on a TextBlock
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class LineStackingStrategySample : Indicator
     {
         protected override void Initialize()
         {
             var stackPanel = new StackPanel
             {
                 Orientation = Orientation.Vertical,
                 BackgroundColor = Color.Gold,
                 Opacity = 0.6,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center
             };
             var stringBuilder = new StringBuilder();
             stringBuilder.AppendLine("First line of text");
             stringBuilder.AppendLine("Second line of text");
             stringBuilder.AppendLine("Third line of text");
             stringBuilder.AppendLine("Fourth line of text");
             stringBuilder.AppendLine("Fifth line of text");
             stackPanel.AddChild(new TextBlock
             {
                 Margin = 5,
                 Text = "LineStackingStrategy = BlockLineHeight:\n" + stringBuilder.ToString(),
                 LineStackingStrategy = LineStackingStrategy.BlockLineHeight,
                 FontWeight = FontWeight.Bold,
                 ForegroundColor = Color.Black
             });
             stackPanel.AddChild(new TextBlock
             {
                 Margin = 5,
                 Text = "LineStackingStrategy = MaxHeight:\n" + stringBuilder.ToString(),
                 LineStackingStrategy = LineStackingStrategy.MaxHeight,
                 FontWeight = FontWeight.Bold,
                 ForegroundColor = Color.Black
             });
             Chart.AddControl(stackPanel);
         }
         public override void Calculate(int index)
         {
         }
     }
 }

Last update: June 26, 2022

Comments