Windows Phone Developers

Tuesday, June 18, 2013

Windows Phone Development : How to Create HyperLinks to External Sites / Pages using Silverlight XAML

How to Link External Websites to Windows Phone Pages using C#/VB.NET

Once you create a  +Windows Phone application with content, you will have a necessity to link it to multiple websites (External etc).

You can use either HyperlinkControl or the Hyperlink XAML Tag to achieve that.

Let's take our Sample App (refer QR Code) which has a good list of Hotels and Restaurants.

The App tries to provide links to these websites.

Adding Hyperlink Tag to the Content/Grid should help.

Exceptions while Adding Hyperlink / Navigating Hyperlink in Windows Phone Application

{"Cannot navigate to locations relative to a page."}

{"Navigation is only supported to relative URIs that are fragments, or begin with '/', or which contain ';component/'.\r\nParameter name: uri"}

The above exceptions are caused when the TargetName is not set to _blank


The http:// prefix is omitted in NavigateUri

The correct representation is given below:

<Hyperlink TargetName="_blank" NavigateUri=""></Hyperlink>

The +Silverlight code worked perfectly bringing the Website as shown below 

See also:

Hyperlink Control in Windows Forms (VB.NET) Application

How to Download File from Website using C# (.NET)

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

1 comment: