I\'m trying to use a hyperlink button as a mailto in silverlight 4 like so:
I was able to work around the error by adding a click event to the xaml and storing the url in the Tag="" property.
XAML:
<HyperlinkButton Content="PDR Drug Handbook" Tag="http://www.pdrhealth.com/" FontSize="14" Click="HyperlinkButton_Click" />
Code Behind:
private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
{
HyperlinkButton button = (HyperlinkButton)sender;
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(button.Tag.ToString()), "_self");
}
EDIT: popup blockers are now less likely to be invoked due to changing the target from "_blank" to "_self"
I figured it out. The hyperlinkButton that works is in a child window (far nested control), the one that doesn't is in the site template (Child of the Application object). For this reason it appears that the hyperlinkbutton in the site template must have TargetName="_blank" specified. Not sure why this is.