Problem: Silverlight 2 & Silverlight 3 do not support HTML, how can I remove the tags?
Solution: Although there are many solutions to this problem, the quickest and most frequently solution I use is a regular expression to remove HTML tags. The most straightforward example I’ve found is from John Papa’s book Data Driven Services with Silverlight 2
// Remove HTML tags and empty newlines and spaces and leading spaces
string formattedValue = REgex.Replace(value as string, "<.*?>", "");
formattedValue = Regex.Replace(formattedValue, @"\n+\s+", "\n\n");
formattedValue = formattedValue.TrimStart(’ ‘);
fromattedValue = HttpUtility.HtmlDecode(formattedValue);
if(length > 0 && formattedValue.Length >= length)
formattedvalue = formattedValue.Substring(0, length - 1);
return formattedValue;



October 2nd, 2009 at 10:01 am
Haha … I had forgotten I had written that code in the book
Glad it is useful for you.
And congrats on the MVP nod!
October 9th, 2009 at 5:15 pm
[...] Corey referred a very useful code snippet provided by John which helps you to strip HTML Tags. [...]