GridLength
Summary
Represents the length of the grid.
Signature
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79 | using cAlgo.API;
namespace cAlgo
{
// This sample shows how to use GridLength
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class GridLengthSample : Indicator
{
[Parameter("Grid Row Length", DefaultValue = 2)]
public int GridRowLength { get; set; }
[Parameter("Grid Row Length Unit Type", DefaultValue = GridUnitType.Auto)]
public GridUnitType GridRowLengthUnitType { get; set; }
[Parameter("Grid Column Length", DefaultValue = 2)]
public int GridColumnLength { get; set; }
[Parameter("Grid Column Length Unit Type", DefaultValue = GridUnitType.Auto)]
public GridUnitType GridColumnLengthUnitType { get; set; }
protected override void Initialize()
{
var grid = new Grid(2, 2)
{
BackgroundColor = Color.Gold,
Opacity = 0.6,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
ShowGridLines = true,
};
for (int iRow = 0; iRow < 2; iRow++)
{
var row = grid.Rows[iRow];
SetGridRowLength(row);
for (int iColumn = 0; iColumn < 2; iColumn++)
{
var column = grid.Columns[iColumn];
SetGridColumnLength(column);
grid.AddChild(new TextBlock
{
Text = string.Format("Row {0} and Column {1}", iRow, iColumn),
Margin = 5,
ForegroundColor = Color.Black,
FontWeight = FontWeight.ExtraBold
}, iRow, iColumn);
}
}
Chart.AddControl(grid);
}
private void SetGridRowLength(GridRow row)
{
switch (GridRowLengthUnitType)
{
case GridUnitType.Auto:
row.SetHeightToAuto();
break;
case GridUnitType.Pixel:
row.SetHeightInPixels(GridRowLength);
break;
case GridUnitType.Star:
row.SetHeightInStars(GridRowLength);
break;
}
}
private void SetGridColumnLength(GridColumn column)
{
switch (GridColumnLengthUnitType)
{
case GridUnitType.Auto:
column.SetWidthToAuto();
break;
case GridUnitType.Pixel:
column.SetWidthInPixels(GridColumnLength);
break;
case GridUnitType.Star:
column.SetWidthInStars(GridColumnLength);
break;
}
}
public override void Calculate(int index)
{
}
}
}
|
See Also
Properties
Value
Summary
Gets or sets the value.
Signature
| public double Value {get;}
|
Return Value
double
UnitType
Summary
Gets or sets the type of the unit.
Signature
| public GridUnitType UnitType {get;}
|
Return Value
GridUnitType