Forum Xamarin.Forms

Same Images Load different inside Listview

Hey Guys,
I have an issue with presenting Images inside a Listview. The exact same Images are displayed in different sizes. They are always inside a Viewcell. I implemented an Infinite-Scrolling Listview so the items are loading on demand via a Rest-Service and the images are loaded via an uri. This is my XAML-Code. Am I missing something out?

 <MasterDetailPage.Detail>
        <TabbedPage android:TabbedPage.ToolbarPlacement="Bottom"
            BarBackgroundColor="#4A4A4A"
            BarTextColor="White"
            android:TabbedPage.BarItemColor="#66FFFFFF"
            android:TabbedPage.BarSelectedItemColor="#FFFFFF">
            <TabbedPage.Children>
                    <ContentPage Title="Öffentlich">
                        <ContentPage.Content>
                        <ListView ItemsSource="{Binding Events}" CachingStrategy="RecycleElement" HasUnevenRows="true">
                            <ListView.Behaviors>
                                <extended:InfiniteScrollBehavior IsLoadingMore="{Binding IsBusy}"/>
                            </ListView.Behaviors>
                            <ListView.ItemTemplate>
                                <DataTemplate>
                                    <ViewCell>
                                        <Grid VerticalOptions="Fill" HorizontalOptions="Fill">
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="50"/>
                                                <RowDefinition Height="Auto" />
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <Label Grid.Row="0" Text="{Binding Title}" FontFamily="FibelNord.ttf#FibelNord" FontSize="32" FontAttributes="Bold" VerticalTextAlignment="Center" HorizontalTextAlignment="Start" Margin="10,0,0,0"/>
                                            <Image Grid.Row="1" Aspect="AspectFill" BackgroundColor="Red" Source="{Binding TitlePicture}"/>
                                        </Grid>
                                    </ViewCell>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>
                    </ContentPage.Content>
                    </ContentPage>

                    <ContentPage Title="Einladungen">
                        <ContentPage.Content>
                            <ListView x:Name="lvPrivateInvites">

                            </ListView>
                        </ContentPage.Content>
                    </ContentPage>

Answers

  • IamPeekIamPeek Member ✭✭


    This is an example as you can see both Images are the same but the second one is higher than the first one, altough they get the same layout (viewcell)

  • jezhjezh Member, Xamarin Team Xamurai

    Are you sure that the two images are the same Uri, not the two images looks like the same?

    Maybe you can set the second RowDefinition Height to a specific value as a workaround .Just like this:

                          <Grid.RowDefinitions>
                                <RowDefinition Height="50"/>
                                <RowDefinition Height="150"  />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
    
  • jezhjezh Member, Xamarin Team Xamurai

    Have you resolved your problem?

Sign In or Register to comment.