Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Replaced ListView with CollectionView.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbritch committed Jan 18, 2021
1 parent 9597234 commit 1873183
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@
Placeholder="Enter age" />
<Button Text="Add to Database"
Clicked="OnButtonClicked" />
<ListView x:Name="listView">
<ListView.ItemTemplate>
<CollectionView x:Name="collectionView">
<CollectionView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Name}"
Detail="{Binding Age}" />
<StackLayout>
<Label Text="{Binding Name}"
FontSize="Medium" />
<Label Text="{Binding Age}"
TextColor="Silver"
FontSize="Small" />
</StackLayout>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
</ContentPage>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public MainPage()
protected override async void OnAppearing()
{
base.OnAppearing();
listView.ItemsSource = await App.Database.GetPeopleAsync();
collectionView.ItemsSource = await App.Database.GetPeopleAsync();
}

async void OnButtonClicked(object sender, EventArgs e)
Expand All @@ -27,7 +27,7 @@ await App.Database.SavePersonAsync(new Person
});

nameEntry.Text = ageEntry.Text = string.Empty;
listView.ItemsSource = await App.Database.GetPeopleAsync();
collectionView.ItemsSource = await App.Database.GetPeopleAsync();
}
}
}
Expand Down
Binary file modified GetStarted/Tutorials/LocalDatabaseTutorial/Screenshots/01All.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1873183

Please sign in to comment.