-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
SwipeViewBindingContextGallery.xaml
100 lines (96 loc) · 4.36 KB
/
SwipeViewBindingContextGallery.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
<?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:vm="clr-namespace:Xamarin.Forms.Controls.GalleryPages.SwipeViewGalleries"
x:Class="Xamarin.Forms.Controls.GalleryPages.SwipeViewGalleries.SwipeViewBindingContextGallery"
Title="SwipeView BindingContext Gallery">
<ContentPage.BindingContext>
<vm:SwipeViewBindingContextGalleryViewModel />
</ContentPage.BindingContext>
<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="SubTitleStyle" TargetType="Label">
<Setter Property="TextColor" Value="DarkGray" />
<Setter Property="FontSize" Value="12" />
<Setter Property="Margin" Value="6, 0" />
</Style>
<DataTemplate x:Key="ItemTemplate">
<SwipeView
HeightRequest="80">
<SwipeView.LeftItems>
<SwipeItems>
<SwipeItemView
Command="{Binding Source={RelativeSource AncestorType={x:Type vm:SwipeViewBindingContextGalleryViewModel}}, Path=SwipeItemTapCommand}"
CommandParameter="{Binding .}">
<Grid
BackgroundColor="Yellow">
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
TextColor="Black"
Text="SwipeItemView"/>
</Grid>
</SwipeItemView>
</SwipeItems>
</SwipeView.LeftItems>
<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="0"
Grid.ColumnSpan="2"
Grid.Row="1"
Text="{Binding SubTitle}"
Style="{StaticResource SubTitleStyle}"/>
</Grid>
</SwipeView>
</DataTemplate>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackLayout
Orientation="Horizontal"
BackgroundColor="Black">
<Label
VerticalOptions="Center"
TextColor="White"
FontAttributes="Bold"
Text="Last tapped item:"/>
<Label
VerticalOptions="Center"
TextColor="White"
Text="{Binding TappedItem.Title}"/>
</StackLayout>
<CollectionView
Grid.Row="1"
x:Name="SwipeCollectionView"
ItemsSource="{Binding Items}"
ItemTemplate="{StaticResource ItemTemplate}" />
</Grid>
</ContentPage.Content>
</ContentPage>