此示例中的mailto链接不工作:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock>Please email
<Hyperlink NavigateUri="mailto:test@test.co.uk">test@test.cp.uk</Hyperlink>
</TextBlock>
</Window>如果我将窗口更改为UserControl,它就能工作。
有人能帮忙吗?
发布于 2014-02-19 13:37:44
在Xaml中:您需要添加RequestNavigate
<TextBlock >
Please email <Hyperlink NavigateUri="mailto:test@test.co.uk" RequestNavigate="Hyperlink_RequestNavigate">test@test.cp.uk</Hyperlink>
</TextBlock>在代码后面:
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}https://stackoverflow.com/questions/21881124
复制相似问题