-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathContentColumnLayout.cs
48 lines (37 loc) · 1.43 KB
/
ContentColumnLayout.cs
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
using Microsoft.Maui.Layouts;
namespace CustomLayouts
{
public class ContentColumnLayout : Layout, IGridLayout
{
public IReadOnlyList<IGridRowDefinition> RowDefinitions { get; }
public IReadOnlyList<IGridColumnDefinition> ColumnDefinitions { get; }
public double RowSpacing => 0;
public double ColumnSpacing => 0;
public ContentColumnLayout(IView header, IView content, IView footer)
{
var gridColumnDefinitions = new List<IGridColumnDefinition>(1)
{
new ColumnDefinition(GridLength.Star)
};
var gridRowDefinitions = new List<IGridRowDefinition>(3)
{
new RowDefinition(GridLength.Auto), // Header
new RowDefinition(GridLength.Star), // Content
new RowDefinition(GridLength.Auto) // Footer
};
ColumnDefinitions = gridColumnDefinitions.AsReadOnly();
RowDefinitions = gridRowDefinitions.AsReadOnly();
Add(header);
Add(content);
Add(footer);
}
public int GetColumn(IView view) => 0;
public int GetColumnSpan(IView view) => 1;
public int GetRow(IView view) => IndexOf(view);
public int GetRowSpan(IView view) => 1;
protected override ILayoutManager CreateLayoutManager()
{
return new GridLayoutManager(this);
}
}
}