Focus of Editor is missing in .net Maui

Vijayadharshini M 20 Reputation points
2023-10-31T07:05:25.51+00:00

Currently I am working with Editor of .net Maui.I have placed the Editor within Border . Initially the editor is read only.Added the tapped gesture listener to Border.

while tapping on the border I have make the IsReadOnly of editor false. The problem I am facing is while tapping on the border the focus of editor is remains for a second. Then the focus is missing. My requirement is to make editor continuously in focused state. While I am tapping in border。

How can I achieve this is there any possibility?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,870 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 68,656 Reputation points Microsoft Vendor
    2023-11-02T01:43:36.6+00:00

    Hello,

    Yes, the cursor no longer flashes after a second and still the cursor inside the editor.In windows I have noticed this issue.

    If the cursor in the Editor, you still get the focus, if you have concern about the focus, you can try to click the Editor and wait for a second, this cursor no longer flashes as well.

    Or you can use following code, you can get focus by Myeditor.Focus(); and check return value in the TapGestureRecognizer_Tapped, if the value is true, the editor gets the focus.

    private async void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
            {
                
                Myeditor.IsReadOnly = false;
                var res=Myeditor.Focus();
                Console.WriteLine(res);
               
            }
    

    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 comments No comments