Selecting text across the elements

shriram 125 Reputation points
2024-07-08T05:50:54.8466667+00:00

I am working on a UWP app where i will get the text content and their respective X and Y coordinates. I need to render this text in UI in the respective coordinates, I have achieved this through canvas panel and text block but here i face another difficulty which is selecting the entire text from different text block. Since i used multiple TextBlock this doesn't allow me to select the entire text

Can anyone help me to achieve this i need to place the text in respective coordinates and also allow to selection the entire text in native selection

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,008 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Roy Li - MSFT 33,371 Reputation points Microsoft Vendor
    2024-07-08T07:36:44.99+00:00

    Hello,

    Welcome to Microsoft Q&A!

    It is by design that you can't select text across multiple TextBlock. When you select text in a TextBlock, actually the TextBlock is focused. Only one element could get focused at one time, so you can't have multiple TextBlock focused. I'd suggest put all the text inside one TextBlock as well.

    Thank you.


    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.