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 1089997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:18:30+00:00 2026-05-16T23:18:30+00:00

I have a string: Item A\r\nItem B\r\nItem C How can I bind this string

  • 0

I have a string:

Item A\r\nItem B\r\nItem C

How can I bind this string to a TextBlock so that it appears as:

Item A
Item B
Item C

Thanks

  • 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-05-16T23:18:31+00:00Added an answer on May 16, 2026 at 11:18 pm

    Just make the TextBlock big enough to show three lines. TextBlock is capable of wrapping the text if it finds newline and carriage return in Text.

    EDIT: Also, make sure that the newline and carriage returns are not hard coded. What I mean is that there is a difference between these two:

    MyString = @"Item A\r\nItem B\r\nItem C";
    

    and…

    MyString = "Item A\r\nItem B\r\nItem C";
    

    The second string will display correctly in the TextBlock but the first will just get displayed in a single line as “Item A\r\nItem B\r\nItem C” because the newline and carriage characters are hard coded instead of being escape characters.

    You can fix that by replacing the hard coded newline and carriage characters with their escape sequences, by:

    MyString = MyString.Replace("\\r\\n", "\r\n");
    

    or preferably by:

    MyString = MyString.Replace("\\r\\n", Environment.NewLine);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string that is something like this: $string = Item 1|Item 2|Item
I have a ComboBox with a label function like this one: private function fieldLabelFunction(item:Object):String
I have a List item List<string> xmlValue = new List<string>(); In this I have
I have stored the XML path to items in a string like this: response->items->item
I have this object Object1 defined as public Object1(String item, List<Object2> obj2) in a
I have an item object that looks like this: item[siteId] = {7BAD6B24-3B69-4CB9-AD02-9B0003C1927D}; item[webId] =
I have a dictionary that looks like this Dictionary<string,string[]> I also have 2 dropdownlist.
i have string like this: string = The stock item 28031 (111111: Test product)
I have a string-array in strings.xml. How can I underline the string in item?
suppose i have a string as string[] _strFile; foreach (ListViewItem item in listview1.Items) {

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.