【发布时间】:2018-10-21 12:36:04
【问题描述】:
我正在构建一个字符串,我必须在其中隐藏一个电子邮件地址。
string StatusText = "Please reach out here for access."
只是想知道如何在字符串中隐藏电子邮件地址。我希望“这里”是一个电子邮件地址。我必须将 StatusText 绑定到一个文本块,这样当用户点击“这里”时,outlook 邮件应该会打开。
详细代码如下:
View.xaml
<TextBlock Text="{Binding StatusText}" />
ViewModel.cs
private string _statusText;
public string StatusText
{
get { return _statusText; }
set { SetProperty(ref _statusText, value); }
}
DisplayMessages()
{
//based on the boolean value, Status Text is set
//When the case is "NoAccess", I want the "here" of StatusText to be clickable and show the mailaddress as abc@abc.com
switch(Flag)
case IsReady:
StatusText = "Application is Ready";
break;
case NoAccess:
StatusText = "Please reach out here. No access can be provided."
break;
}
【问题讨论】:
-
string contactDetails = "Please reach out to your contact@domain.com for access."你的问题是什么?您的意思是要使用LinkLabel控件吗? -
@Saveen 你认为这会达到什么效果?
-
@John 我已经编辑了问题以获得更多理解。
-
OP this 回答你的问题了吗?
-
@user42067 他们为什么不一次问整个问题?这不是询问然后逐渐编辑问题的正确方法。没有人可以帮助您采用这种方法。
标签: c# wpf string email hyperlink