[Bug] Scroll breaks for ScrollView (or works on some tiny part of it) in nested grid after ScrollView translation by Y
#9,263 opened on 2020年1月20日
説明
Description
We have a grid with two elements: another grid with scrollview and any view, Both pushed to bottom. When we try to translate by Y both scrollview and second view from root grid - scroll for scrollview doesnt work or works on some tiny part of scrollview. If we don't use nested grid then scrollview scrolls.
Steps to Reproduce
From description, plus we have a codebehind for button which translates views (scrollView and x:Name="_button" button) by Y further to bottom and back. When views translation changed to 60 by Y - scroll doesnt work or works on some tiny part of scrollview.
Xaml for nested grid:
<?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:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="TranslationBug.Views.MainPage">
<ContentPage.Content>
<Grid Padding="20" RowSpacing="8">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid RowSpacing="8" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Button Text="Translate scrollview" Clicked="TranslateView" Grid.Row="1"/>
<ScrollView x:Name="_scrollView" Grid.Row="2" Orientation="Horizontal" Padding="0, 20, 0, 20">
<StackLayout Orientation="Horizontal" Spacing="10">
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
</StackLayout>
</ScrollView>
</Grid>
<Button x:Name="_button" Text="I do nothing" Grid.Row="1"/>
</Grid>
</ContentPage.Content>
</ContentPage>
Xaml when scroll works (without nested grid):
<?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:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="TranslationBug.Views.MainPage">
<ContentPage.Content>
<Grid Padding="20" RowSpacing="8">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Button Text="Translate scrollview" Clicked="TranslateView" Grid.Row="1"/>
<ScrollView x:Name="_scrollView" Grid.Row="2" Orientation="Horizontal" Padding="0, 20, 0, 20">
<StackLayout Orientation="Horizontal" Spacing="10">
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
<Frame Padding="8" CornerRadius="13" BackgroundColor="AliceBlue" HasShadow="false">
<Label Text="Label" FontSize="20"></Label>
</Frame>
</StackLayout>
</ScrollView>
<Button x:Name="_button" Text="I do nothing" Grid.Row="3"/>
</Grid>
</ContentPage.Content>
</ContentPage>
Screenshot of layout

Expected Behavior
ScrollView scrolling works
Actual Behavior
ScrollView doesn't scroll
Basic Information
- Nuget Packages: Xamarin.Forms 4.3.0.908675
Reproduction Link
Where scroll breaks: TranslationBug_nested.zip