【发布时间】:2019-05-29 16:28:16
【问题描述】:
我尝试使用 x:bind 函数来显示使用 String.Concat() 连接两个字符串的字符串。我按照这个网站的指示:https://docs.microsoft.com/en-us/windows/uwp/data-binding/function-bindings
由于这是Stack Overflow上的第一个问题,如果我问的方式有误,请指出。谢谢(≧∀≦)ゞ
我尝试在另一个命名空间中创建的函数中使用 System.Contact(),它看起来不错。
xmlns:sys="using:System"
xmlns:local="using:uwpppp.Scenes.ReciteF">
...
<TextBlock Text="{x:Bind sys:String.Concat('hello','123')}"/><!--not good-->
<TextBlock Text="{x:Bind local:Showdetail.GetString('hello','hello2')}"/><!--good-->
public static String GetString(string a, string b)
{
return String.Concat(a, b);
}
无效的绑定路径 'sys:String.Concat('hello','123')' : 函数参数 '1' 无效或不匹配
【问题讨论】:
-
我遇到了同样的问题。当我使用我自己的类中的函数时它可以工作,但在使用 System.
-
这是 UWP 中的一个错误,尚未修复。你会在 UWP 中发现很多功能。你想达到什么目的?