I'm a newbie with wpf , what i want to display the text in one line in wpf textblock. eg.:
<TextBlock
Text ="asfasfasfa
asdasdasd"
</TextBlock>
TextBlock display it in two lines default,
but i want it in only one line like this"asafsf asfafaf". I mean show all the text in one line even there are more than one lines in the text
what should i do?
Use a Converter:
SingleLineTextConverter.cs:
Instead of this:
Use this:
or this:
or set Text property in code behind like this :
(In XAML)
(In code - c#)
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: