-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
SwipeBindableLayoutGallery.xaml
101 lines (96 loc) · 4.55 KB
/
SwipeBindableLayoutGallery.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?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="Xamarin.Forms.Controls.GalleryPages.SwipeViewGalleries.SwipeBindableLayoutGallery"
Title="Swipe BindableLayout">
<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="TitleStyle" TargetType="Label">
<Setter Property="FontSize" Value="14" />
<Setter Property="TextColor" Value="Black" />
<Setter Property="Margin" Value="6, 0, 6, 6" />
</Style>
<Style x:Key="DateStyle" TargetType="Label">
<Setter Property="TextColor" Value="DarkGray" />
<Setter Property="FontSize" Value="10" />
<Setter Property="Margin" Value="6, 0, 6, 6" />
</Style>
<Style x:Key="SubTitleStyle" TargetType="Label">
<Setter Property="TextColor" Value="DarkGray" />
<Setter Property="FontSize" Value="12" />
<Setter Property="Margin" Value="6, 0" />
</Style>
<DataTemplate x:Key="MessageTemplate">
<SwipeView
HeightRequest="80">
<SwipeView.LeftItems>
<SwipeItems>
<SwipeItem
Text="Favourite"
Icon="calculator.png"
BackgroundColor="Yellow"
Command="{Binding Source={x:Reference SwipeStackLayout}, Path=BindingContext.FavouriteCommand}"/>
</SwipeItems>
</SwipeView.LeftItems>
<SwipeView.RightItems>
<SwipeItems
Mode="Execute">
<SwipeItem
Text="Delete"
Icon="coffee.png"
BackgroundColor="Red"
Command="{Binding Source={x:Reference SwipeStackLayout}, Path=BindingContext.DeleteCommand}"/>
</SwipeItems>
</SwipeView.RightItems>
<SwipeView.Content>
<Grid
BackgroundColor="White"
RowSpacing="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label
Grid.Column="0"
Grid.Row="0"
Text="{Binding Title}"
Style="{StaticResource TitleStyle}"/>
<Label
Grid.Column="1"
Grid.Row="0"
Text="{Binding Date}"
Style="{StaticResource DateStyle}"/>
<Label
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="1"
Text="{Binding SubTitle}"
Style="{StaticResource SubTitleStyle}"/>
<Label
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="2"
Text="{Binding Description}"
Style="{StaticResource SubTitleStyle}"/>
</Grid>
</SwipeView.Content>
</SwipeView>
</DataTemplate>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<ScrollView
HorizontalScrollBarVisibility="Never">
<StackLayout
x:Name="SwipeStackLayout"
BindableLayout.ItemsSource="{Binding Messages}"
BindableLayout.ItemTemplate="{StaticResource MessageTemplate}"/>
</ScrollView>
</ContentPage.Content>
</ContentPage>