Entry Focus issue in scroll view Maui

Vaibhav Methuku 160 Reputation points
2025-03-24T16:37:02.26+00:00

I had created a view with 30 entries in a scroll view, for suppose I focus on the 16 entry and click in the background Entry 1 is being focused automatically.

Here is the code for reference.

   <ScrollView
       BackgroundColor="Green"
       HorizontalOptions="FillAndExpand"
       VerticalOptions="FillAndExpand">
       <VerticalStackLayout
           Padding="20"
           BackgroundColor="Yellow"
           Spacing="10">
           <Label
               FontSize="24"
               HorizontalOptions="Center"
               Text="Enter Values" />
           <VerticalStackLayout
               x:Name="EntryContainer"
               BackgroundColor="Orange"
               Spacing="10" />
       </VerticalStackLayout>
   </ScrollView>

Callign the load entries in the constructor, I had tried this in the contentview maui

 private void LoadEntries()
 {
     for (int i = 1; i <= 30; i++)
     {
         var entry = new Entry
         {
             Placeholder = $"Entry {i}",
             FontSize = 16
         };
         EntryContainer.Children.Add(entry);
     }
 }

explaing the same,

If I click on the yellow background after focusing the 16th entry, automatically 1st entry is focussed.

Please help me with this issue.

User's image

Facing this issue in windows

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2025-03-25T02:58:57.7033333+00:00

    Hello,

    I can reproduce this issue in my side with your nuget package version.

    Please update Microsoft.Maui.Controls 9.0.14  and Microsoft.Maui.Controls.Compatibility 9.0.14

    Then open your.csproj file. Update .NET version to 9.0, if I click on the yellow background after focusing the 16th entry, 1st entry will not be focused.

    <PropertyGroup>
    <TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
    <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
    

    By the way, after updating nuget package version and csproj file, please clean the project and rebuild it.

    Best Regards,

    Leon Lu


    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.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.