Set Cursor Position to specific line in Multiline textbox c# winui 3

Hemanth B 886 Reputation points
2022-10-07T17:04:49.777+00:00

Hi I am using C# WinUI 3 WinAppSDK for my app.

I want to set the position of the cursor to a specific line in the multiline textbox.
I've searched the web a lot but couldn't find suitable answers.

For example, I have 34 lines of text in a textbox.
I want the cursor to scroll to the 31st line of the textbox.
How do I initiate this?

Windows development Windows App SDK
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Junjie Zhu - MSFT 21,646 Reputation points
    2022-10-10T10:18:28.073+00:00

    Hello @Hemanth B ,
    Welcome to Microsoft Q&A!

    At present, it can only be achieved by selecting the text content, but the specific line cannot be operated directly, which may require calculation.

    You can go to GitHub and ask if there is a better solution.
    https://github.com/microsoft/microsoft-ui-xaml/issues

    Thank you.
    Junjie


    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

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.