Skip to content

Instantly share code, notes, and snippets.

@tugcearar
Last active July 15, 2018 13:25
Show Gist options
  • Save tugcearar/96911de354ae2f8280d31b26c20967b7 to your computer and use it in GitHub Desktop.
Save tugcearar/96911de354ae2f8280d31b26c20967b7 to your computer and use it in GitHub Desktop.
<?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:control="clr-namespace:XFEmptyViewSample.Controls"
xmlns:helper="clr-namespace:XFEmptyViewSample.Helpers"
xmlns:viewmodel="clr-namespace:XFEmptyViewSample.ViewModels"
x:Class="XFEmptyViewSample.Views.ListViewPage" Title="Birds">
<ContentPage.BindingContext>
<viewmodel:ListViewPageViewModel/>
</ContentPage.BindingContext>
<ContentPage.Resources>
<ResourceDictionary>
<helper:Converter x:Key="Converter" />
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.ToolbarItems>
<ToolbarItem Name="Refresh" Command="{Binding RefreshCommand}" Order="Primary" Text="Refresh" Priority="0" />
</ContentPage.ToolbarItems>
<ContentPage.Content>
<Grid>
<control:EmptyView VerticalOptions="Center" HorizontalOptions="Center" IsVisible="{Binding IsEmpty}" />
<ListView
IsVisible="{Binding IsEmpty, Converter={StaticResource Converter}}"
ItemsSource="{Binding BirdsList}"
HasUnevenRows="true"
IsPullToRefreshEnabled="true"
IsRefreshing="{Binding IsRefreshing}"
RefreshCommand="{Binding RefreshCommand}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Vertical" Margin="20,20,20,20" Spacing="10">
<Label Text="{Binding Title}"
FontSize="Large"
VerticalOptions="End"
HorizontalOptions="Center"
TextColor="Gray"></Label>
<Label Text="{Binding Description}"
FontSize="Small"
VerticalOptions="End"
HorizontalOptions="Center"
TextColor="Gray"></Label>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</ContentPage.Content>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment