How to show basic HTML Windows8 Metro style TextBlock?

五迷三道 提交于 2019-12-05 08:27:26

I am developing a open source Windows 8 Metro RSS Reader app and I used HtmlUtilities.ConvertToText

You can see the source code implementation here http://metrorssreader.codeplex.com/SourceControl/changeset/view/17913#265003

If you want to do it in XAMl, just add a converter.

    public sealed class TextToHtmlConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, string language)
    {
        if (value is string)
        {
            return HtmlUtilities.ConvertToText(value.ToString());
        }
        else
        {
            return value;
        }
    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
        throw new NotImplementedException();
    }
}

Then in your XAML add a resource reference.

Then Bind with a converter:

Text="{Binding titleFull,Converter={StaticResource TextToHtmlConverter}}"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!