forked from dylanberry/XamarinDynamicUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainPage.xaml
71 lines (71 loc) · 4.25 KB
/
MainPage.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
71
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:XamlFlags"
x:Class="XamlFlags.MainPage"
x:Name="Page">
<ContentPage.BindingContext>
<local:MainPageViewModel />
</ContentPage.BindingContext>
<StackLayout BindableLayout.ItemsSource="{Binding Options}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Frame CornerRadius="4" Padding="0">
<StackLayout Orientation="Horizontal" Padding="5" BackgroundColor="White">
<StackLayout.Triggers>
<DataTrigger TargetType="StackLayout" Binding="{Binding IsEnabled}" Value="false">
<Setter Property="IsEnabled" Value="false" />
</DataTrigger>
<MultiTrigger TargetType="StackLayout">
<MultiTrigger.Conditions>
<BindingCondition Binding="{Binding IsEnabled}" Value="false"/>
<BindingCondition Binding="{Binding IsSelected}" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="BackgroundColor" Value="DarkGray" />
</MultiTrigger>
<MultiTrigger TargetType="StackLayout">
<MultiTrigger.Conditions>
<BindingCondition Binding="{Binding IsEnabled}" Value="true"/>
<BindingCondition Binding="{Binding IsSelected}" Value="true"/>
</MultiTrigger.Conditions>
<Setter Property="BackgroundColor" Value="DarkBlue" />
</MultiTrigger>
</StackLayout.Triggers>
<Button Text="Select"
Command="{Binding BindingContext.SelectTypeCommand, Source={x:Reference Page}}"
CommandParameter="{Binding .}"/>
<Label Text="✓"
TextColor="White"
FontSize="12"
HorizontalOptions="EndAndExpand" VerticalOptions="Center">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding IsSelected}" Value="False">
<Setter Property="IsVisible" Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
<Label Text="{Binding Value}" TextColor="Black"
HorizontalOptions="EndAndExpand" VerticalOptions="Center">
<Label.Triggers>
<MultiTrigger TargetType="Label">
<MultiTrigger.Conditions>
<BindingCondition Binding="{Binding IsEnabled}" Value="false"/>
<BindingCondition Binding="{Binding IsSelected}" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="TextColor" Value="LightGray" />
</MultiTrigger>
<MultiTrigger TargetType="Label">
<MultiTrigger.Conditions>
<BindingCondition Binding="{Binding IsEnabled}" Value="true"/>
<BindingCondition Binding="{Binding IsSelected}" Value="true"/>
</MultiTrigger.Conditions>
<Setter Property="TextColor" Value="White" />
</MultiTrigger>
</Label.Triggers>
</Label>
</StackLayout>
</Frame>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
</ContentPage>