MainPage.xaml 2.05 KB
Newer Older
Mattia's avatar
Mattia committed
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
<?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:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="SampleApp.MainPage">
    <StackLayout>
        <ListView ItemsSource="{Binding APIList}"
                  ItemTapped="OnListViewItemTapped"
                  IsGroupingEnabled="True"
                  GroupDisplayBinding="{Binding LongName}"
                  GroupShortNameBinding="{Binding ShortName}"
                  RowHeight="100"
                  >
            <ListView.ItemTemplate>
                <DataTemplate>
                    
                    <ViewCell>
                        <StackLayout BackgroundColor="#fff" Orientation="Vertical" Padding="10, 0, 0, 0">
                            <StackLayout Orientation="Vertical" VerticalOptions="CenterAndExpand">
                                <Label Text="{Binding Description}" TextColor="Black" FontSize="Default"/>
                                <Label Text="{Binding Availability}" HorizontalOptions="FillAndExpand" TextColor="#999" FontSize="Micro"/>
                            </StackLayout>
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
            <ListView.GroupHeaderTemplate>
                <DataTemplate>
                    <ViewCell>
                        <StackLayout BackgroundColor="#eee" Orientation="Vertical" Padding="10, 0, 0, 0">
                            <StackLayout VerticalOptions="CenterAndExpand">
                                <Label Text="{Binding LongName}" TextColor="#333" FontSize="Medium"/>
                            </StackLayout>
                                
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.GroupHeaderTemplate>
        </ListView>
        

    </StackLayout>
</ContentPage>