Editor in ListView ItemTemplate not resizing when typing on iOS

Lars Vinberg 101 Reputation points
2021-03-05T18:05:40.443+00:00

My ListView ItemTemplate contains an Editor with AutoSize="TextChanges".
On UWP and Android my ViewCell resizes properly when typing, but not on iOS.
I have tried multiple variations on container view (Grid, StackLayout, ContentView etc) but cannot find a solution for iOS that works.
Cell.ForceUpdateSize() is a no-go as it causes the editor to unfocus.

Any ideas on workaround? I'll report this as an iOS bug to the Xamarin team as well.

XAML that exhibits this behavior - works on Android, UWP but not iOS:

    <ListView HasUnevenRows="True">
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Grid VerticalOptions="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Editor AutoSize="TextChanges" Text="{Binding}" />
                    </Grid>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,326 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lars Vinberg 101 Reputation points
    2021-03-07T01:11:25.267+00:00

    Bug reported to Xamarin team and verified.

    As a workaround I migrated to CollectionView which works flawlessly on iOS and Android in this respect, but is not fully supported on UWP.
    So I'm being forced to use parallel implementations using ListView and CollectionView. Hmpf.


0 additional answers

Sort by: Most helpful