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}}" />
精彩评论