Is any way to create ListView
with horizontal scroll
in Xamarin.Forms
like image
this is what i have done for vertical
var myListView = new ListView { ItemTemplate = new DataTemplate(typeof(ImageCell)) };
CollectionView and ListView differencesCollectionView has a flexible layout model, which allows data to be presented vertically or horizontally, in a list or a grid. CollectionView supports single and multiple selection. CollectionView has no concept of cells.
CarouselView is available in Xamarin. Forms 4.3. However, it is currently experimental and can only be used by adding the following line of code to your AppDelegate class on iOS, or to your MainActivity class on Android, before calling Forms.
ListView is a view for presenting lists of data, especially long lists that require scrolling. CollectionView is a view for presenting lists of data using different layout specifications. It aims to provide a more flexible, and performant alternative to ListView . For more information, see Xamarin.
As of Xamarin Forms 2.3 CarouselView
does just that, and more. Read more here.
<ContentView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> <CarouselView ItemsSource="{Binding MyDataSource}"> <CarouselView.ItemTemplate> <DataTemplate> <Label Text="{Binding LabelText}" /> </DataTemplate> </CarouselView.ItemTemplate> </CarouselView> </ContentView>
Yes, you technically can. Set the Rotation to 270 (all VisualElements have a Rotation BindableProperty). However, this looks like a suboptimal solution as there are white spaces at the top and bottom and you have to drag the view left and right to see everything fully.
public static readonly BindableProperty RotationProperty; public static readonly BindableProperty RotationXProperty; public static readonly BindableProperty RotationYProperty;
The code above is from the VisualElement class. The code below is a small sample of my own.
∨∨∨ <ListView x:Name="MessagesListView" Rotation="270" ItemsSource="{Binding Items}" RowHeight="40"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <ViewCell.View> <StackLayout> <!--mylayouthere--> </StackLayout> </ViewCell.View> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With