email hyperlinkbutton

后端 未结 2 1023
再見小時候
再見小時候 2021-01-18 09:49

I\'m trying to use a hyperlink button as a mailto in silverlight 4 like so:



        
相关标签:
2条回答
  • 2021-01-18 09:58

    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");
        }
    
    • http://forums.silverlight.net/t/245500.aspx/1

    EDIT: popup blockers are now less likely to be invoked due to changing the target from "_blank" to "_self"

    0 讨论(0)
  • 2021-01-18 10:03

    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.

    0 讨论(0)
提交回复
热议问题