<?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="XamarinStudy.Views.SampleListViewPage">
    <ContentPage.Content>
        <StackLayout>
            <SearchBar x:Name="foodSearchBar" Placeholder="원하시는 음식을 입력해 주세요" TextChanged="foodSearchBar_TextChanged"/>
            <ListView x:Name="mainListView" ItemSelected="mainListView_ItemSelected" ItemsSource="{Binding .}" Footer="{Binding .}"
                      IsPullToRefreshEnabled="True" Refreshing="mainListView_Refreshing">
                <ListView.Header>
                    <ContentView BackgroundColor="Salmon">
                        <Label Text="음식 리스트" HorizontalTextAlignment="Center" FontSize="Large" TextColor="White"/>
                    </ContentView>
                </ListView.Header>
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <TextCell Text="{Binding Name}" Detail="{Binding Price}"/>
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.FooterTemplate>
                    <DataTemplate>
                        <Label Text="{Binding Count, StringFormat='{0}ea'}" HorizontalTextAlignment="Center" FontSize="Medium" TextColor="Navy"/>
                    </DataTemplate>
                </ListView.FooterTemplate>
            </ListView>
            <ListView x:Name="groupedListView" ItemSelected="mainListView_ItemSelected" ItemsSource="{Binding .}" Footer="{Binding .}"
                      IsPullToRefreshEnabled="True" Refreshing="mainListView_Refreshing"
                      IsGroupingEnabled="True" GroupDisplayBinding="{Binding Key}">
                <ListView.Header>
                    <ContentView BackgroundColor="Salmon">
                        <Label Text="음식 리스트" HorizontalTextAlignment="Center" FontSize="Large" TextColor="White"/>
                    </ContentView>
                </ListView.Header>
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <TextCell Text="{Binding Name}" Detail="{Binding Price}"/>
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.FooterTemplate>
                    <DataTemplate>
                        <Label Text="{Binding Count, StringFormat='{0}ea'}" HorizontalTextAlignment="Center" FontSize="Medium" TextColor="Navy"/>
                    </DataTemplate>
                </ListView.FooterTemplate>
            </ListView>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>