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

Anyone ever get rows to size correctly using just "HasUnevenRows"?

$
0
0

I've personally always had to use a custom renderer which calculates the cell size based off the model the cell is bound to. I've been doing some experimenting in a test project using the latest 1.5.0-pre1 and randomly generated strings for the datasource. Seems that they will size correctly if my viewcell contains nothing but a label.

List View....

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
             xmlns:customCell="clr-namespace:ListViewScrollBug;assembly=ListViewScrollBug"
             x:Class="ListViewScrollBug.MyListView">
    <StackLayout>
        <Button Text="Add More Rows" Clicked="AddMoreRows_Clicked" />
        <ListView   x:Name="Lv"
                    ItemsSource="{Binding Items}" 
                    VerticalOptions="FillAndExpand"
                    HorizontalOptions="FillAndExpand"
                    SeparatorColor="Lime"
                    HasUnevenRows="true">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <customCell:TestCell />
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>
</ContentPage>

<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms" 
          xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
          x:Class="ListViewScrollBug.TestCell">
    <StackLayout Padding="10,0,10,0" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="Gray">
        <Label x:Name="MyLabel" />
    </StackLayout>
</ViewCell>

https://dropbox.com/s/sp0c1iuwilyfvda/Screen%20Shot%202015-08-14%20at%2010.16.51%20AM.png?dl=0

But if i add a picture it doesn't seem to work.

<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms" 
          xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
          x:Class="ListViewScrollBug.TestCell">
    <StackLayout Padding="10,0,10,0" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="Gray">
        <Image Source="https://15254b2dcaab7f5478ab-24461f391e20b7336331d5789078af53.ssl.cf1.rackcdn.com/xamarin.vanillaforums.com/userpics/822/pKWUYBJT6FMN0.png" />
        <Label x:Name="MyLabel" />
    </StackLayout>
</ViewCell>

https://dropbox.com/s/okbjxpp850yq8an/Screen%20Shot%202015-08-14%20at%2010.21.00%20AM.png?dl=0

Anybody have any tips to getting this to work correctly?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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