Hi,
you can use WebBrowser to display your string and replace NewLine (\n) in string. Try following demo:
XAML
<Window x:Class="WpfApp1.Window023"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">
<Grid>
<WebBrowser x:Name="wb"/>
</Grid>
</Window>
And CodeBehind:
using System.Windows;
namespace WpfApp1
{
public partial class Window023 : Window
{
public Window023()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
string str = @"<b>Title: </b>My title\n<b>Description: </b>This is my description.\n";
str = str.Replace("\\n", "<br />");
wb.NavigateToString(str);
}
}
}
Result: