Reputation: 123
I tried to scroll when i focus on textfield but it's not working. if user write anything in textfield. it should be scroll.
<ContentPage.Content>
<StackLayout BackgroundColor="{StaticResource 00dp}">
<Frame BorderColor="Transparent" VerticalOptions="FillAndExpand" Margin="10,20,10,20" Padding="0" BackgroundColor="{StaticResource 02dp}" Grid.Row="0" CornerRadius="20" >
<ScrollView VerticalScrollBarVisibility="Always" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="{StaticResource 02dp}">
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Grid Margin='20' RowSpacing="0" ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="90*"/>
</Grid.ColumnDefinitions>
<-- more controls -->
</Grid>
</StackLayout>
</ScrollView>
</Frame>
</StackLayout>
Upvotes: 0
Views: 251
Reputation: 10156
Per your description, this could be a known issue that being tracked in the link below, you can follow up there. And I also noticed that you've opened Inside Stacklayout ScrollView not working #4176 on Github, you can continue following up there.
https://github.com/dotnet/maui/issues/12452
As an alternative workaround for now, you can make the ScrollView
a direct child of AbsoluteLayout
like below:
<AbsoluteLayout >
<ScrollView
AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0,0,1,1">
<StackLayout Padding="10,10,10,300">
<-- more controls -->
</StackLayout>
</ScrollView>
</AbsoluteLayout>
Upvotes: 0
Reputation: 496
I don't know id this answers your concern, but maybe you should take a look at the ScrollViewer's documentation for ScrollView as a root layout.
In your case, having the ScrollViewer inside of a StackLayout removes all purpose of the ScrollViewer. As the StackLayout will grow to accommodate to the size of all it's children, meaning that it will take up all the space without any constraint or need for it to scroll. You should have the ScrollViewer as the root element of you page in order to constrain it's content to the page size.
<ContentPage.Content>
<ScrollView VerticalScrollBarVisibility="Always" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="{StaticResource 02dp}">
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Grid Margin='20' RowSpacing="0" ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="90*"/>
</Grid.ColumnDefinitions>
<-- more controls -->
</Grid>
</StackLayout>
</ScrollView>
</ContentPage.Content>
Upvotes: 1