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

Commit 1873183

Browse files
committed
Replaced ListView with CollectionView.
1 parent 9597234 commit 1873183

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

GetStarted/Tutorials/LocalDatabaseTutorial/LocalDatabaseTutorial/MainPage.xaml

+11-6
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@
99
Placeholder="Enter age" />
1010
<Button Text="Add to Database"
1111
Clicked="OnButtonClicked" />
12-
<ListView x:Name="listView">
13-
<ListView.ItemTemplate>
12+
<CollectionView x:Name="collectionView">
13+
<CollectionView.ItemTemplate>
1414
<DataTemplate>
15-
<TextCell Text="{Binding Name}"
16-
Detail="{Binding Age}" />
15+
<StackLayout>
16+
<Label Text="{Binding Name}"
17+
FontSize="Medium" />
18+
<Label Text="{Binding Age}"
19+
TextColor="Silver"
20+
FontSize="Small" />
21+
</StackLayout>
1722
</DataTemplate>
18-
</ListView.ItemTemplate>
19-
</ListView>
23+
</CollectionView.ItemTemplate>
24+
</CollectionView>
2025
</StackLayout>
2126
</ContentPage>

GetStarted/Tutorials/LocalDatabaseTutorial/LocalDatabaseTutorial/MainPage.xaml.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public MainPage()
1313
protected override async void OnAppearing()
1414
{
1515
base.OnAppearing();
16-
listView.ItemsSource = await App.Database.GetPeopleAsync();
16+
collectionView.ItemsSource = await App.Database.GetPeopleAsync();
1717
}
1818

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

2929
nameEntry.Text = ageEntry.Text = string.Empty;
30-
listView.ItemsSource = await App.Database.GetPeopleAsync();
30+
collectionView.ItemsSource = await App.Database.GetPeopleAsync();
3131
}
3232
}
3333
}
-33.7 KB
Loading

0 commit comments

Comments
 (0)