I followed the answer in
Displaying html from string in WPF WebBrowser control
to bind to list of html content, so I'm able to display it in a WPF program I've built. I can't figure out how to get the ' and " to display properly.
Displaying HTML from string in a WebBrowser control doesn't properly display ' or "
Here is my XAML:
<Grid Grid.Column="1" Grid.Row="2">
<Border BorderThickness="2" BorderBrush="{DynamicResource TitleBrush}" Margin="50,0">
<WebBrowser utility:BrowserBehavior.Html="{Binding SelectedEmail.EmailContent}"
ScrollViewer.VerticalScrollBarVisibility="Hidden"/>
</Border>
</Grid>
Here is my code:
public class BrowserBehavior
{
public static readonly DependencyProperty HtmlProperty = DependencyProperty.RegisterAttached(
"Html",
typeof(string),
typeof(BrowserBehavior),
new FrameworkPropertyMetadata(OnHtmlChanged));
[AttachedPropertyBrowsableForType(typeof(WebBrowser))]
public static string GetHtml(WebBrowser d)
{
return (string)d.GetValue(HtmlProperty);
}
public static void SetHtml(WebBrowser d, string value)
{
d.SetValue(HtmlProperty, value);
}
static void OnHtmlChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
WebBrowser webBrowser = dependencyObject as WebBrowser;
if (webBrowser != null)
webBrowser.NavigateToString(e.NewValue as string ?? " ");
}
}
See the link above how with questions. Any help on how to get the ' or " to display would be much appreciate.
I have already tried to replace ' with &apos and ' with no results.
Example of Problem:
We have added several overlay options for the frame line. Each option will allow you to pick either “STD†(Doesn’t auto add butt doors) or “BUTT†(Auto adds butt doors).
Example of Proper Format:
We have added several overlay options for the frame line. Each option will allow you to pick either "STD" (Doesn't auto add butt doors) or "BUTT" (Auto adds butt doors).