简体   繁体   English

使用资源和静态文本设置HyperlinkBut​​ton.NavigateUri属性

[英]Setting the HyperlinkButton.NavigateUri Property with Resource and static text

iam trying to populate the HyperlinkButton.NavigateUri Property with a string from the properties... But i would like also to append some additional text to the string saved in the app property. 我试图用来自属性的字符串填充HyperlinkBut​​ton.NavigateUri属性。但是我也想向app属性中保存的字符串添加一些附加文本。

here is what i have: in the application property under the name Email i saved the following information: admin@testdomain.com 这是我所拥有的:在应用程序属性中的电子邮件名称下,我保存了以下信息:admin@testdomain.com

in window.xaml i have: 在window.xaml中,我有:

<TextBlock>
<Hyperlink NavigateUri="mailto:{Binding Source={x:Static my:Settings.Default}, Path=Email}?subject=Email From My App" RequestNavigate="Hyperlink_RequestNavigate">
<Run Text="Email ME!"/>
</Hyperlink>
</TextBlock>

Problem is: 问题是:

mailto:{Binding Source={x:Static my:Settings.Default}, Path=Email}?subject=Email From My App" mailto:{绑定源= {x:静态my:Settings.Default},Path = Email}?subject =来自我的应用的电子邮件”

How would i just join the string to be a valid NavigateUri Property ? 我如何才能将字符串加入成为有效的NavigateUri属性?

Thanks in advance 提前致谢

You could take also advantage of a custom converter using the IValueConverter interface. 您还可以使用IValueConverter接口使用自定义转换器。

You would be more flexible because I saw that you are also setting the subject (and maybe other proberties). 您会更加灵活,因为我看到您也在设置主题(也许还有其他探针)。

So your Converter could do other fancy thinks and it would be clean plugable, just if you want to go more fancy =)... 所以您的Converter可以做其他花哨的想法,即使您想花更多的钱,它也可以插拔,这很干净。

Example of IValueConverter Interface... this has to be changed to bind to the proper case of course: http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.aspx IValueConverter接口示例...必须更改此值以绑定到适当的情况下: http : //msdn.microsoft.com/zh-cn/library/system.windows.data.ivalueconverter.aspx

HTH 高温超导

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM