Problem with scrolling in my iOS App.

JulianPasqueJulianPasque USMember ✭✭✭

Hey guys,
I am facing a problem with scrolling in a ScrollView in my iOS App. My aim is to implement a chatview.
My XAML looks like this:

<Grid VerticalOptions="Fill" x:Name="MainGrid" Padding="5,5,0,15">
        <Grid.RowDefinitions>
          <RowDefinition Height="*" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <local:ChatScrollView x:Name="ChatList" Padding="10" Grid.Row="0" Grid.ColumnSpan="2" VerticalOptions="FillAndExpand" >
          <StackLayout x:Name="ChatMessagesListView"  />
        </local:ChatScrollView>
        <services:EditorGrows Grid.Column="0" Grid.Row="1" AutomationId="EntryMessage" Keyboard="Chat" x:Name="ChatText" Text="" HorizontalOptions="FillAndExpand" Focused="KeyBoardVisible" Unfocused="KeyBoardInVisible"/>
        <Button Grid.Column="1" AutomationId="ButtonMessage" Grid.Row="1" Style="{DynamicResource SecondaryActionButtonStyle}" Text="Senden" VerticalOptions="EndAndExpand"  Clicked="CmdSend"/>
      </Grid>

This is the EditorGrows:

public class EditorGrows : Editor { public EditorGrows() { this.TextChanged += (sender, e) => { this.InvalidateMeasure(); }; } }

On Android everything is working perfectly, but on iOS when I press "Return" on the keyboard the Scrollview scrolls to the top and this is what I don't want to happen.

Could it be, that the ScrollView is scrolling because of the call fo the InvalidateMeasure method?

Best regards
Julian

Answers

Sign In or Register to comment.