开发者

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?

In particular I'd 开发者_如何学运维like to call my object's .ToString() method.

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.


<ObjectDataProvider x:Key="myKey" d:IsDataSource="True" ObjectType="{x:Type MyNameSpace:MyClass}" MethodName="ToString"/>

and

<TextBlock Text="{Binding Source={StaticResource myKey}}" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜