+3  A: 

Instead of this:

            <TextBlock Text="Hello
                How Are
                You??"/>

Use this:

            <TextBlock>
                Hello
                How Are
                You??
            </TextBlock>

or this:

            <TextBlock>
                <Run>Hello</Run> 
                <Run>How Are</Run> 
                <Run>You??</Run>
            </TextBlock>

or set Text property in code behind like this :

(In XAML)

            <TextBlock x:Name="MyTextBlock"/>

(In code - c#)

            MyTextBlock.Text = "Hello How Are You??"

Code-behind approach has an advantage that you can format your text before setting it. Example: If the text is retrieved from a file and you want to remove any carriage-return new-line characters you can do it this way:

 string textFromFile = System.IO.File.ReadAllText(@"Path\To\Text\File.txt");
 MyTextBlock.Text = textFromFile.Replace("\n","").Replace("\r","");
Mihir Gokani
Actually the text to display is in a file, so i can't do it like that , is there another way? Thank you very much.
baorui
Please check my edited answer for this.
Mihir Gokani
+3  A: 
<TextBlock Text={Binding Path=TextPropertyName,Converter={StaticResource TextLineConverter}}

In that TextLineConverter write to remove the enter Key and return final Text .

Kishore Kumar
How about if you gave the converter source code as an example here? I don't have VS handy so I can't paste it in. The source code would make this the definitive answer.
Thorsten79
Thaht's good way , thank you~~
baorui
A: 

using System; using System.Collections.Generic; using System.Text; using System.Windows.Data;

namespace MyProject { class TextLineConverter : IValueConverter {

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string x = (string) Value; string y = x.replace("\n","").replace("\r",""); return y;

}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new Exception("The method or operation is not implemented."); }

} }

just try

Kishore Kumar