Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HTML Hyperlinks in XBAP
Message
De
15/02/2009 15:27:54
 
 
À
14/02/2009 17:50:33
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Versions des environnements
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01381699
Message ID:
01381947
Vues:
19
Yep... you're right. It does work, but only when you load the html as a Uri object. I've tried all the usual methods...

NavigateToString(htmlString)
NavigateToFile(fileName)
Navigate(Uri)

... and they all load and display the HTML just fine. But the only one that would respond to a standard HTML hyperlink is Navigate(Uri), which requires a physical file as the source. So I ended up testing the HTML to see if it contained a hyperlink and writing to a temp file if it does. Here's the code (I used StrToFile() from VFPToolkit for .NET which of course works flawlessly :)
            string HTMLText = ((BLL.dsBriefPages)(((object[])(e.AddedItems))[0])).BRPAGES_PAGEHTML;
            if (HTMLText.IndexOf("a href", 0, StringComparison.InvariantCultureIgnoreCase) > 0)
            {
                StrToFile(HTMLText, @"c:\temp\BRITemp.htm");
                Uri file = new Uri(@"c:\temp\BRITemp.htm", UriKind.Absolute);
                PageViewer.Navigate(file);
            }
            else
            {
                PageViewer.NavigateToString(HTMLText + "\n\n");
            }
I suppose that XAML hyperlinks would work fine, but the source HTML is produced by others using an HTML editor so I have to deal with that for now.

Thanks!

Larry
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform