Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9087171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:39:05+00:00 2026-06-16T21:39:05+00:00

Enviroment I am developing a Windows Store App I created a TextBox with wordwrapping

  • 0

Enviroment

I am developing a Windows Store App I created a TextBox with wordwrapping like so

<ScrollViewer x:Name="ScrollView"  Margin="0" Grid.Row="1" Background="Black" BorderThickness="2" BorderBrush="White" KeyDown="keyDown" VerticalScrollBarVisibility="Auto" HorizontalScrollMode="Disabled" ZoomMode="Disabled" IsHorizontalRailEnabled="False" IsHorizontalScrollChainingEnabled="False">
    <Grid x:Name="Canvas" SizeChanged="setConsoleWidth">
        <TextBox x:Name="textbox" Text="TextBox" Foreground="White" FontSize="24" FontFamily="Assets/inconsolata.ttf#inconsolata" AcceptsReturn="True" BorderThickness="0" Background="{x:Null}" SelectionChanged="handleCaret" Margin="0" IsTextPredictionEnabled="False" TextWrapping="Wrap"/>
        <Rectangle x:Name="Caret" Stroke="Black" Fill="White" StrokeThickness="0" Margin="571,260,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="0" Height="0"/>
    </Grid>
</ScrollViewer>

The idea is that you can vertically scroll but not horizontally scroll in “textbox”.

Problem

I want the textbox to wrap all characters outside of the boundary to a new line. Words do not have to be completly preserved. When a character is outside the boundary that character should appear on a new line. Moreover, the previous character should stay on the previous line. This should be done with all characters including whitespace.

Current behavior

The current behavior can be explained with the following image:

Example behavior
Figure 1: Example behavior

When the caret is located at the last character of our line (Figure 1.1) two things can happen when you enter a character, depending on the character type:

  • Character type: non-space (including tabs) all characters

    Current behavior
    The word you are appending characters to is simply wrapped to the newline. See figure 1.2.

    Desired behavior
    Only the character is wrapped to the newline, in case of figure 1.2, the character ‘d’
    will only be on the second line.

  • Character type: space

    Current behavior
    The space and index is not wrapped and just continues on the current line (see figure 1.3). Inserting another space will not make that space wrap (see figure 1.4, the caret is out of screen). The next non-space character is wrapped to the newline, but the space character will just stay on the first line.

    Desired behavior
    The space is wrapped to the newline, in case of figure 1.2, the character ‘d’
    will only be on the second line.


How do achieve this desired behavior (The page is backed by c#)?

Edit:

I was able to change the character-space behavior into the non-space behavior by replacing all spaces with nonbreaking-spaces(“\u00A0”). Now I only need a solution for the first part.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:39:06+00:00Added an answer on June 16, 2026 at 9:39 pm

    Following your idea you could insert a zero-width space after each character. It is the unicode symbol 200B (http://en.wikipedia.org/wiki/Zero-width_space). I just tried with Windows Forms and there it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a Windows 8 Store app. Till sometime back I could see
I am developing Android app on Eclipse using a Windows environment with ADT. I
I am developing an Android app on my Windows 7 Home PC using Eclipse.
I am new to windows phone. I am developing a web-app and the test
fellow anthropoids and lily pads and paddlewheels! I'm developing a Windows desktop app in
I am developing a Windows Phone 7 App which is capable to work without
Firstly, I come from Windows-VisualStudio-C++ background. Now I am developing in a Ubuntu environment.
I'd like to start developing for iPhone or Android in my spare time, as
I'm getting close to desperate.. I am developing a field service application for Windows
I'm a one man show developing a C++ Windows application for a customer. Over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.