This project is read-only.

Problems with BBCodeBlock: new line character doesn't work

Oct 20, 2013 at 8:12 AM
Edited Oct 20, 2013 at 8:51 AM
I have a class containing const string variables that hold message text.
I am trying to assign this const string variable to BBCode property of BBCodeBlock control.
My string variable MSG_GREETING value is "Welcome [b]{0}[/b].

{1}"
I set the BBCode value like this:
bcbGreetingMsg.BBCode = String.Format(MSG_GREETING, _username, _greetingmessage);

_username, _greetingmessage are string variable containing text retrieved from db.

The problem is the characters responsible for rendering a new line/ line break are displayed verbose and no new line/line break gets added.
However the [b] tag is correctly formatted and the username part is correctly rendered in bold.

Now, if I set the message text at design time like this:
<mui:BBCodeBlock x:Name="bcbGreetingMsg"  BBCode="Welcome [b]{0}[/b].&#13;&#10;&#13;&#10;{1}" Margin="0,0,0,32" />
and at run time I do
String.Format(bcbGreetingMsg.BBCode, _username, _greetingmessage);
the new line/ line break is rendered correctly. Strange!

Can someone here please help me out.

Note: I am not using MVVM in this project but classic WinForms style event driven programming. Poor me I know. :(

Thanks in advance.
Nov 3, 2013 at 4:02 PM
Guys! I am still struggling with this. Any help will be greatly appreciated.
Nov 3, 2013 at 4:02 PM
Guys! I am still struggling with this. Any help will be greatly appreciated.
Nov 3, 2013 at 4:03 PM
Guys! I am still struggling with this. Any help will be greatly appreciated.
Dec 25, 2014 at 4:30 PM
The problem is not in line breaks. Are you sure that _username and _greetingmessage doesn't contains following symbols '[' ']' ?