Alex
Alex

Reputation: 21

Write text in the selected areas

I have this wpf code.

<TextBlock Name="TB" TextWrapping="Wrap" Text="das   asd     asdasd  asd asd as d as   2323213      123123" Style="{StaticResource PhoneTextTitle1Style}"/>

I need to write a text in one of these red areas.

enter image description here

At the same time I need to specify the position of the text like this:

    TB.Inlines.Add(new Run() { Text="123", ContentX = 4, ContetLine= 1});
    TB.Inlines.Add(new Run() { Text="B", ContentX = 6, ContentLine= 2});
    TB.Inlines.Add(new Run() { Text="55555", ContentX = 7, ContentLine= 4});

Text may be added by using Inlines with custom text color and style.

And i dont know font size and where text will be wrapped.

Edit 1:

The text can be different.

Chars may be styled (color, font size, text style).

I need something like full array of chars and pointer.

Upvotes: 1

Views: 99

Answers (1)

Jan W
Jan W

Reputation: 948

Regular Expressions maybe? (using System.Text.RegularExpressions) To find the first space the code would be:

  [a-z]+

You would just count the found characters then and cut the string.

Upvotes: 1

Related Questions