45 lines
2.2 KiB
Plaintext
45 lines
2.2 KiB
Plaintext
![]() |
<?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="MobApp.Views.ItemsPage"
|
||
|
Title="{Binding Title}"
|
||
|
xmlns:local="clr-namespace:MobApp.ViewModels"
|
||
|
xmlns:model="clr-namespace:MobApp.Models"
|
||
|
x:Name="BrowseItemsPage">
|
||
|
|
||
|
<ContentPage.ToolbarItems>
|
||
|
<ToolbarItem Text="Add" Command="{Binding AddItemCommand}" />
|
||
|
</ContentPage.ToolbarItems>
|
||
|
<!--
|
||
|
x:DataType enables compiled bindings for better performance and compile time validation of binding expressions.
|
||
|
https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/data-binding/compiled-bindings
|
||
|
-->
|
||
|
<RefreshView x:DataType="local:ItemsViewModel" Command="{Binding LoadItemsCommand}" IsRefreshing="{Binding IsBusy, Mode=TwoWay}">
|
||
|
<CollectionView x:Name="ItemsListView"
|
||
|
ItemsSource="{Binding Items}"
|
||
|
SelectionMode="None">
|
||
|
<CollectionView.ItemTemplate>
|
||
|
<DataTemplate>
|
||
|
<StackLayout Padding="10" x:DataType="model:Item">
|
||
|
<Label Text="{Binding Text}"
|
||
|
LineBreakMode="NoWrap"
|
||
|
Style="{DynamicResource ListItemTextStyle}"
|
||
|
FontSize="16" />
|
||
|
<Label Text="{Binding Description}"
|
||
|
LineBreakMode="NoWrap"
|
||
|
Style="{DynamicResource ListItemDetailTextStyle}"
|
||
|
FontSize="13" />
|
||
|
<StackLayout.GestureRecognizers>
|
||
|
<TapGestureRecognizer
|
||
|
NumberOfTapsRequired="1"
|
||
|
Command="{Binding Source={RelativeSource AncestorType={x:Type local:ItemsViewModel}}, Path=ItemTapped}"
|
||
|
CommandParameter="{Binding .}">
|
||
|
</TapGestureRecognizer>
|
||
|
</StackLayout.GestureRecognizers>
|
||
|
</StackLayout>
|
||
|
</DataTemplate>
|
||
|
</CollectionView.ItemTemplate>
|
||
|
</CollectionView>
|
||
|
</RefreshView>
|
||
|
</ContentPage>
|