Maui for Android context menu pop-up paste in Editor scroll problem
Haviv Elbsz
2,071
Reputation points
Hello All. in my app when the Editor contains many lines of text and I tap the pop-up cut menu and then I long press and tap the paste menu the Editor text scroll to the bottom of the Editor and also the screen scroll to the bottom. Note that I disabled all the scroll toasync methods and that not stop the screen scroll. How I can fix this. I'm using Maui net 8 and android Ver 34. Thank you.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="EditorSelectAll.MainPage">
<ScrollView>
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Border x:Name="eBorder" StrokeThickness="1" Stroke="#107e71"
Padding="10,0,10,0" BackgroundColor="#DFE9F5" >
<ScrollView x:Name="editscroll" Orientation="Both" HeightRequest="400" MinimumWidthRequest = "-1"
HorizontalScrollBarVisibility="Never" VerticalScrollBarVisibility="Never" >
<Editor x:Name="InputTB"
FontSize="18" FlowDirection="LeftToRight"
AutoSize="TextChanges" TextChanged="InputTB_TextChanged"
IsSpellCheckEnabled="False"
FontAttributes="Bold" IsTextPredictionEnabled="False"
FontFamily="NCourier" >
</Editor>
</ScrollView>
</Border>
<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Fill" />
<Label
Text="Welcome to .NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />
<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />
<Label
Text="Welcome to .NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />
<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />
<Label
Text="Welcome to .NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />
<Label
Text="Hello, World!"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />
<Label
Text="Welcome to .NET Multi-platform App UI"
Style="{StaticResource SubHeadline}"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I" />
</VerticalStackLayout>
</ScrollView>
</ContentPage>
Layout background code.
namespace EditorSelectAll
{
public partial class MainPage : ContentPage
{
int count = 0;
string msg, msg1;
public MainPage()
{
InitializeComponent();
}
private void OnCounterClicked(object sender, EventArgs e)
{
count++;
if (count == 1)
CounterBtn.Text = $"Clicked {count} time";
else
CounterBtn.Text = $"Clicked {count} times";
SemanticScreenReader.Announce(CounterBtn.Text);
msg1 = "This is a select all test why its scroll down and hdden";
for(int j =0; j < 120; j++)
{
msg += " " + j + " " + msg1 + "\n";
}
InputTB.Text = msg;
}
private void InputTB_TextChanged(object sender, TextChangedEventArgs e)
{
}
}
}
Sign in to answer