Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to get items in a ListView to display horizontally?

$
0
0

So basically my binding works but i dont want the items to be scrollable vertically but to be scrollable horizontally
ive looked around ListView xaml page and it has no option to display the information horizontally.
and i know there must be a way

<?xml version="1.0" encoding="UTF-8"?>

<ContentPage.Padding>

</ContentPage.Padding>
<ContentPage.Resources>

        <Style x:Key="EventButtonStyle" TargetType="Button">
            <Setter Property="HorizontalOptions" Value="Start"/>
            <Setter Property="TextColor" Value="Teal" />
            <Setter Property="FontSize"  Value="12"/>
            <Setter Property ="HeightRequest" Value="10"/>
        </Style>

    </ResourceDictionary>

</ContentPage.Resources>
<StackLayout   HeightRequest="100" VerticalOptions="Fill" HorizontalOptions="FillAndExpand" Spacing="1" BackgroundColor="#40c1c6">
<Grid Padding="20" >
    <!-- this list view is what i need to pull the images from the data template i need to figure out
    how exactly if i should return the imagecell only and bind also need to find out if
    im actually returning any values -->
<ListView  x:Name="PartyEvent" ItemsSource="{Binding}" ListView.HasUnevenRows="True" HorizontalOptions="Center" >

        <ListView.ItemTemplate>

            <DataTemplate>

                <!--<ImageCell ImageSource="{Binding eventPicture}" Text="{Binding eventName}"/>-->
                <ViewCell>
                    <Grid RowSpacing="12" ColumnSpacing="12">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="30" />
                            <RowDefinition Height="1*" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="12" />
                        </Grid.RowDefinitions>

                        <Label FontSize="40" Text="{Binding eventName}" HorizontalOptions="Center" VerticalOptions="Start"
                                     VerticalTextAlignment="Center" HorizontalTextAlignment="End"
                                     Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" />


                        <Image Source="{Binding eventPicture}"
                                     WidthRequest="110" HeightRequest="70"
                                     Aspect="AspectFill"
                                     HorizontalOptions="Center" VerticalOptions="Start"
                               Grid.Row="0" Grid.Column="1"  Grid.RowSpan="2" />

                        <Label Text="{Binding eventPromoter}" FontSize="18"  FontAttributes="Bold"
                                     Grid.Row="0" Grid.Column="2" VerticalTextAlignment="Start" />
                        <Label Text="{Binding location}" FontSize="14"
                                     Grid.Row="1"  Grid.Column="2" Grid.RowSpan="2"/>


                    </Grid>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
    </Grid>
    </StackLayout>


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>