【问题标题】:Add hyperlink into a string placeholder xaml将超链接添加到字符串占位符 xaml
【发布时间】:2017-01-05 07:10:24
【问题描述】:

我从名为 SupportEmail "Send an email to {0} to get access" 的应用程序资源中获得了一个字符串。我想向占位符添加电子邮件超链接。

我可以使用我绑定到的以下属性对字符串执行此操作

public string SupportEmail {
get {
 return String.Format(AppResources.SupportEmail, DesiredEmail);
    }
}

还有xaml代码:

<TextBlock Text="{Binding SupportEmail }" />

当前实施:发送电子邮件至 john@doe.com 以获取访问权限

期望的实现:发邮件到john@doe.com获取 访问

我怎样才能做到这一点,使电子邮件是一个超链接?

【问题讨论】:

标签: c# .net xaml windows-phone-8


【解决方案1】:

这可能对你有用

<TextBlock>Send an email to 
    <Hyperlink NavigateUri="john@doe.com" 
               RequestNavigate="OnNavigate">john@doe.com
    </Hyperlink> 
    to get access
</TextBlock>

在后面的代码中

private void OnNavigate(object sender, RequestNavigateEventArgs e)
{
    Process.Start(e.Uri.AbsoluteUri);
    e.Handled = true;
}

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-26
  • 1970-01-01
  • 2022-11-11
  • 2023-03-14
  • 2021-04-14
相关资源
最近更新 更多