'Alternatives to CollectionView in UWP
I think CollectionView doesnt work with UWP apps is there a alternative to this?
I have this view an I dont know if there is a way to make it work in UWP. Its works fine in Android but doesnt load at all in the UWP version
<?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="MovieApp.Common.Views.MoviesPage"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
Title="Movies Box"
>
<Grid>
<RefreshView Command="{Binding RefreshMoviesCommand}"
IsRefreshing="{Binding IsRefreshing}">
<CollectionView ItemsSource="{Binding allMovies}" RemainingItemsThreshold="{Binding MovieTreshold}" RemainingItemsThresholdReachedCommand="{Binding MovieTresholdReachedCommand}"
ItemsLayout="VerticalGrid, 3" SelectionMode="Single" SelectedItem="{Binding SelectedMovie}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="2">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="30" />
<RowDefinition Height="1" />
</Grid.RowDefinitions>
<ffimageloading:CachedImage Grid.Row="0" Margin="0"
Source="{Binding poster_path, StringFormat= 'http://image.tmdb.org/t/p/w500/{0}'}"
Aspect="AspectFill"
HeightRequest="240"
WidthRequest="100" />
<Label Grid.Row="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"
Text="{Binding title}" TextColor="White" FontSize="14"
LineBreakMode="TailTruncation" />
<StackLayout Background="black" Grid.Row="2"
BackgroundColor="Black" />
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
<ActivityIndicator IsRunning="{Binding IsLoadingData}"
HeightRequest="30"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="30"/>
</Grid>
</ContentPage>
Solution 1:[1]
You could use ListView or GridView in UWP to display a collection of data like what you did in Xamarin using CollectionView.
You could get more information here: List view and grid view
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Roy Li - MSFT |