电子邮件超链接按钮 [英] email hyperlinkbutton
问题描述
我正在尝试使用超链接按钮作为silverlight 4中的mailto,如下所示:
I'm trying to use a hyperlink button as a mailto in silverlight 4 like so:
<HyperlinkButton x:Name="hlbCustomerSupport" NavigateUri="mailto:customerservice@fofo.com" Content="customerservice@fofo.com"></HyperlinkButton>
当我在应用程序中点击它时,我得到:
and when I click it in the application I get:
网页错误详情
Webpage error details
用户代理:Mozilla / 4.0(兼容;
MSIE 8.0; Windows NT 6.1; Trident / 4.0;
SLCC2; .NET CLR 2.0.50727; .NET CLR
3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C;
.NET4.0E)时间戳:2011年1月19日星期三
14:24:29 UTC
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E) Timestamp: Wed, 19 Jan 2011 14:24:29 UTC
消息:
中的未处理错误Silverlight应用程序代码:4004
类别:ManagedRuntimeError
消息:System.ArgumentException:
无法加载URI的内容。
URI可能无效。参数
name:uri at
System.Windows.Navigation.NavigationService.NavigateCore(Uri
uri,NavigationMode mode,Boolean
suppressJournalAdd,Boolean
isRedirect)at
System.Windows.Controls.Frame.Navigate(Uri
来源)
MS.Internal.NavigationHelper.TryInternalNavigate()
at
MS.Internal.NavigationHelper.Navigate(布尔
checkUserInitiatedAction)
System.Windows.Controls.HyperlinkButton.OnClick()
at
System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs
e) at
System.Windows.Controls.Control.OnMouseLeftButtonUp(Control
ctrl,EventArgs e)at
MS.Internal.JoltHelper.FireEvent(IntPtr
unmanagedObj,IntPtr unmanagedObjArgs,
Int32 argsTypeIndex,String eventName)
Message: Unhandled Error in
Silverlight Application Code: 4004
Category: ManagedRuntimeError
Message: System.ArgumentException:
Content for the URI cannot be loaded.
The URI may be invalid. Parameter
name: uri at
System.Windows.Navigation.NavigationService.NavigateCore(Uri
uri, NavigationMode mode, Boolean
suppressJournalAdd, Boolean
isRedirect) at
System.Windows.Controls.Frame.Navigate(Uri
source) at
MS.Internal.NavigationHelper.TryInternalNavigate()
at
MS.Internal.NavigationHelper.Navigate(Boolean
checkUserInitiatedAction) at
System.Windows.Controls.HyperlinkButton.OnClick()
at
System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs
e) at
System.Windows.Controls.Control.OnMouseLeftButtonUp(Control
ctrl, EventArgs e) at
MS.Internal.JoltHelper.FireEvent(IntPtr
unmanagedObj, IntPtr unmanagedObjArgs,
Int32 argsTypeIndex, String eventName)
我在其他地方以编程方式执行此操作。我尝试了同样的方法,但仍然得到错误。
I do this programatically elsewhere and it works. I tried the same approach for this one and still get the error.
推荐答案
我想通了。有效的hyperlinkButton在子窗口(远嵌套控件)中,而不在站点模板中的那个(Application对象的Child)。因此,网站模板中的超链接按钮似乎必须指定TargetName =_ blank。不知道为什么会这样。
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.
这篇关于电子邮件超链接按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!