An unexpected behavior occurs when set a long string in the TextBox

2024-07-23T20:12:29.08+00:00

Hello,

This problem happens when I try to put a string with a length greater than 15.684 characters.

The height of TextBox increases abruptly and the TextBox turns into non-editable.

Please, help me handle it

Example

Universal Windows Platform (UWP)
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
814 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Junjie Zhu - MSFT 18,501 Reputation points Microsoft Vendor
    2024-07-24T03:24:51.7733333+00:00

    Hi @Rayane Thaís Gomes de Lima France ,

    Welcome to Microsoft Q&A!

    It is recommended that you use text wrapping and vertical scrollbars to solve this problem.

    TextBox Enable multi-line input

     <TextBox AcceptsReturn="True" 
              TextWrapping="Wrap" 
              MaxHeight="52" 
              ScrollViewer.VerticalScrollBarVisibility="Auto"/>
    

    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.