-
Notifications
You must be signed in to change notification settings - Fork 32
/
GridPage.xaml
70 lines (70 loc) · 3.47 KB
/
GridPage.xaml
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
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Flexibility.Shared.GridPage"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:Page.LargeTitleDisplay="Never">
<ContentPage.Resources>
<Style x:Key="gridCell" TargetType="Label">
<Setter Property="HeightRequest" Value="80"/>
<Setter Property="FlexLayout.Grow" Value="0"/>
<Setter Property="VerticalTextAlignment" Value="Center"/>
<Setter Property="HorizontalTextAlignment" Value="Center"/>
<Setter Property="FontSize" Value="Small"/>
<Setter Property="TextColor" Value="#556"/>
<Setter Property="BackgroundColor" Value="#eed"/>
</Style>
<Style x:Key="full" TargetType="Label"
BasedOn="{StaticResource gridCell}">
<Setter Property="FlexLayout.Basis" Value="100%"/>
</Style>
<Style x:Key="half" TargetType="Label"
BasedOn="{StaticResource gridCell}">
<Setter Property="FlexLayout.Basis" Value="50%"/>
<Setter Property="BackgroundColor" Value="CornflowerBlue"/>
</Style>
<Style x:Key="third" TargetType="Label"
BasedOn="{StaticResource gridCell}">
<Setter Property="FlexLayout.Basis" Value="33.33%"/>
<Setter Property="BackgroundColor" Value="Pink"/>
</Style>
<Style x:Key="fourth" TargetType="Label"
BasedOn="{StaticResource gridCell}">
<Setter Property="FlexLayout.Basis" Value="25%"/>
<Setter Property="BackgroundColor" Value="LightBlue"/>
</Style>
<Style x:Key="auto" TargetType="Label"
BasedOn="{StaticResource gridCell}">
<Setter Property="FlexLayout.Grow" Value="1"/>
<Setter Property="BackgroundColor" Value="Coral"/>
</Style>
</ContentPage.Resources>
<ScrollView>
<StackLayout>
<Label Text="Basic Grids"
TextColor="#778"
FontAttributes="Bold"
FontSize="20"
Margin="6,6,0,6" />
<FlexLayout Wrap="Wrap"
Direction="Row">
<Label Style="{StaticResource full}" Text="Full"/>
<Label Style="{StaticResource half}" Text="1/2" />
<Label Style="{StaticResource half}" Text="1/2" />
<Label Style="{StaticResource fourth}" Text="1/4" />
<Label Style="{StaticResource half}" Text="1/2" />
<Label Style="{StaticResource fourth}" Text="1/4" />
<Label Style="{StaticResource third}" Text="1/3" />
<Label Style="{StaticResource third}" Text="1/3" />
<Label Style="{StaticResource third}" Text="1/3" />
<Label Style="{StaticResource fourth}" Text="1/4" />
<Label Style="{StaticResource fourth}" Text="1/4" />
<Label Style="{StaticResource fourth}" Text="1/4" />
<Label Style="{StaticResource fourth}" Text="1/4" />
<Label Style="{StaticResource fourth}" Text="1/4" />
<Label Style="{StaticResource third}" Text="1/3" />
<Label Style="{StaticResource auto}" Text="left-over" />
</FlexLayout>
</StackLayout>
</ScrollView>
</ContentPage>