[英]Binding to a member function which takes no parameters?
In WPF VS2010, is it possible to bind to a member function which takes no parameters? 在WPF VS2010中,是否可以绑定到不带参数的成员函数?
In particular I'd like to call my object's .ToString() method. 特别是我想调用我的对象的.ToString()方法。
I don't see why it's not possible, but I can't get it to work. 我不明白为什么不可能,但我无法让它发挥作用。 It seems silly and pollutes my code to add a property that simply calls ToString.
看起来很愚蠢并且污染我的代码来添加一个简单地调用ToString的属性。
<ObjectDataProvider x:Key="myKey" d:IsDataSource="True" ObjectType="{x:Type MyNameSpace:MyClass}" MethodName="ToString"/>
和
<TextBlock Text="{Binding Source={StaticResource myKey}}" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.