Windows 8 Metro RichTextColumns embeds hyperlinks and images

I am creating a simple rss reader application for Windows 8 in C # and XMAL.

The feed returns the html content for the body of the article.

I create an ItemDetailPage and it uses RichTextBlock columns to display columns of text that look great.

Therefore, I am binding the Content property to a rich text block that uses HtmlUtilities.ConvertToText to parse text from html content.

It works well. However, I still want to have hyperlinks and images in the content. I originally used WebView and NavigateToString, but you cannot use columns to get a long page of text that I don't want.

Is there any way to do this? I can analyze images and hyperlinks using the Html Agility Pack metro port, but is there any way to insert these hyperlinks and images? For images, I was thinking of adding richtextcolumns to the class, so when I created a new column, before adding this, he added an image. This may work, but it will be terrible with the image at the beginning of each column.

Does anyone have any ideas how this can be achieved? I would be like the contoso news application project that they have http://msdn.microsoft.com/en-us/library/windows/apps/hh868272.aspx . If you go to the article page, they have a block quote in the article’s content.

+5
source share
2 answers

RichTextBlock , - . Inlines Runs, InlineUIContainer . InlineUIContainer , XAML, , .

html Inline:

    public void AddLink(XElement element)
    {
        var link = element.Attribute("href").Value;

        InlineUIContainer uc = new InlineUIContainer();
        TextBlock tb = new TextBlock();
        tb.Margin = new Thickness(0, 0, 0, 0);
        var run = new Run();
        run.Text = element.Value;
        tb.Inlines.Add(run);
        tb.Tapped += (s, e) =>
        {
            Launcher.LaunchUriAsync(new Uri(link, UriKind.Absolute));
        };
        uc.Child = tb;
        paragraph.Inlines.Add(uc);
    }

+4

All Articles