Hello,
I've made a code test for your issue.
Here are steps of the solution that you can try:
Step1: Use multiple ScrollViews to control views for freezing:
<ScrollView x:Name="name">
<Grid x:Name="GridTitle" Grid.Row="0" Margin="10">
//your grid code
</Grid>
</ScrollView>
<ScrollView x:Name="buttons">
<Grid x:Name="GridButtons" Margin="10">
//your grid code
</Grid>
</ScrollView>
<ScrollView x:Name="dataView">
<Label x:Name="LabelPostDetailsFull" etc./>
</ScrollView>
Step2: Add the Scrolled
event to the constructor of the corresponding ContentPage
dataView.Scrolled += DataScrollView_Scrolled;
private async void DataScrollView_Scrolled(object sender, ScrolledEventArgs e)
{
await buttons.ScrollToAsync(e.ScrollX, e.ScrollY, false);
ScrollView scrollView = sender as ScrollView;
double scrollingSpace = scrollView.ContentSize.Height - scrollView.Height;
if (e.ScrollY==0|| scrollingSpace <= e.ScrollY)
name.IsVisible = true;
else
name.IsVisible = false;
}
If you use spacing in the outermost StackLayout, you need to modify scrollingSpace <= e.ScrollY
to scrollingSpace <= e.ScrollY+layout.Spacing
.
In addition, If you have many elements in your GridView, the performance will be poor. You can use ListView instead.
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.