locked
Problem with redrawing listview row height in iOS RRS feed

  • Question

  • User63223 posted

    I have a ListView of items that are made up of a button, a label, and then a picker and an entry. By default, the entry is hidden. If the picker item selected is one that requires a note field to be completed, the entry will become visible. This works great on Android. I have attached screenshots of what I get on iOS.

    The first image is the default appearance. Which is as intended. When the picker is changed to another item to trigger the entry visibility to true, it appears but it doesn't resize the row height. (as shown in 2nd image) If I change the orientation of the device, it will refresh the row height and show as intended (3rd image).

    I'm actually having multiple issues with items not refreshing properly in iOS and wondering if anyone has ran into something similar that could provide some assistance.__

    Wednesday, May 27, 2015 10:05 AM

All replies

  • User84418 posted

    The above post was me. Not sure how it got posted with that other account. I'm still signed in on this one too. Weird.

    Wednesday, May 27, 2015 10:10 AM
  • User65389 posted

    @David.Welsh:

    You don't want rename to Xamarin.Skillweb (as Skillweb sounds good)...? :wink: Joking aside, you should send this problem to Xamarin-Support. To your problem, you should post some code (is the ListView bound..?, do you have a datatemplate (ViewCell) set..?)

    Wednesday, May 27, 2015 10:42 AM
  • User84418 posted

    I've just noticed that the images I've uploaded to the original post don't seem to be there. Strange behaviour on the forums today! I've added them again in this post. (see below)

    @FredyWenger To answer your questions, yes. Here's my listview. Hope you like Xaml. :smile:

    <ListView Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" ItemsSource="{Binding Products}" HasUnevenRows="True"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid BackgroundColor="{Binding BackgroundColour, Converter={StaticResource StringToColorConverter}}"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Button Grid.Row="0" Grid.Column="0" Grid.RowSpan="5" VerticalOptions="FillAndExpand" HorizontalOptions="CenterAndExpand" Style="{StaticResource ButtonStyle}" Image="{Binding ConsignmentTypeImage}" BackgroundColor="{Binding ConsignmentTypeColor, Converter={StaticResource StringToColorConverter}}" Command="{Binding PerformToggleConsignmentType}" BorderRadius="0"/> <Label Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" Text="{Binding Barcode}" Font="{x:Static local:Fonts.LargeFont}" VerticalOptions="CenterAndExpand" HorizontalOptions="StartAndExpand"/> <Frame Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Padding="3" BackgroundColor="#FFFFFFFF" OutlineColor="Gray" HasShadow="False" IsVisible="{Binding Grouped, Converter={StaticResource BooleanToInvertedBooleanConverter}}"> <Grid Padding="6,0,0,0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Image Grid.Column="0" Source="{Binding ProductSuccessFailureImage}" Opacity="0.75" HorizontalOptions="Center" VerticalOptions="Center"/> <stvc:BindablePicker Grid.Column="1" ItemsSource="{Binding TrackAndTraceTypes}" SelectedIndex="{Binding SelectedTrackAndTraceIndex}" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" IsVisible="{Binding Grouped, Converter={StaticResource BooleanToInvertedBooleanConverter}}"/> </Grid> </Frame> <Label Text="" Grid.Row="2" IsVisible="{Binding Grouped}"/> <scvc:ClearableEntry Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" EntryText="{Binding TandTNote}" EntryPlaceholder="{Binding TandTNotePlaceholder}" EntryIcon="{Binding NoteEntryIcon}" IsVisible="{Binding ShowTandTNote}" HorizontalOptions="Fill"/> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

    Wednesday, May 27, 2015 10:52 AM
  • User65389 posted

    @David.Welsh:

    Hope you like Xaml

    Unfortunately no (I don't use XAML and do all in code...) :cry:
    In code, I would do the ViewCell with a StackLayout (instead of a Grid). But... I'm sure that some "XAML-lovers" can give you an answer.. :wink:

    And, you really should send a mail to the Xamarin-support regarding your forum-problem...

    Wednesday, May 27, 2015 11:06 AM
  • User84418 posted

    So it looks like this is caused by the HasUnevenRows property not working in iOS. Is there a good work around to this?

    Thursday, May 28, 2015 8:41 AM
  • User65389 posted

    @David.Welsh: Since a few versions, HasUnevenRows works in iOS with ListView.
    I use ListView's with custom ViewCell (Datatemplate) on various pages (with variable height) (in code not XAML). Maybe you want to check this out...

    Thursday, May 28, 2015 8:47 AM
  • User84418 posted

    @FredyWenger Ah thanks. I'm reading some old posts maybe. I'll have a look.

    Thursday, May 28, 2015 8:49 AM
  • User84418 posted

    Hmm it seems my uneven rows are working. I've got 2 things in the list and they're different sizes. So this isn't the issue. I've tried reworking the layout to use a stacklayout too. No difference though. Must be an issue refreshing the view.

    Thursday, May 28, 2015 8:52 AM
  • User84418 posted

    This is still an issue for me unfortunately. Anyone ever worked this out?

    Tuesday, January 26, 2016 11:25 AM
  • User180397 posted

    I am now fighting with the listview truncation problem in every project. This is a big pain.

    Tuesday, February 9, 2016 10:43 PM
  • User92384 posted

    I am not an iOS expert, if I'm wrong, please correct me.

    In iOS, view cell seems not auto re-calc height after changes. You need to manually call Control.ReloadRows in ListViewRenderer. To get the 1st param of this method, you may call this Foundation.NSIndexPath.FromIndex

    Tuesday, February 9, 2016 11:00 PM