【发布时间】:2013-03-20 10:09:34
【问题描述】:
我有一个像下面这样的静态类:
public static class Lang
{
public static string GetString(string name)
{
//CODE
}
}
现在我想在 xaml 中访问这个静态函数作为绑定。 有没有这样的方法例如:
<Label Content="{Binding Path="{x:static lang:Lang.GetString, Parameters={parameter1}}"/>
或者是否需要为每个可能的参数创建一个 ObjectDataProvider?
希望有人能够帮助我。提前致谢!
【问题讨论】:
-
你不能创建一个转换器,或者格式化字符串,例如Content="{Binding Path=MyValue, StringFormat=You searched for {0}}"/> ?
-
string.Format 只是一个示例输出。将澄清问题。