How do you apply a ValueConverter to a convention-based Caliburn.Micro binding?

£可爱£侵袭症+ 提交于 2019-12-08 16:55:05

问题


How do you apply a ValueConverter to a convention-based Caliburn.Micro binding? or do you need to use the {Binding} syntax?

I know I could do this

<TextBlock
    Text="{Binding Foo, Converter=fooToBarConverter}" />

but how do I apply that custom converter if I am using Caliburn.Micro's convention over configuration, like

<TextBlock
    x:Name="Foo" />

Thanks,


回答1:


You need to replace the ConventionManager.ApplyValueConverter func. By default it only does athe bool => Visibility conversion. Also, you can replace the ApplyStringFormat func for conventional string formatting. Have a look in the ConventionManager to see how it works.



来源:https://stackoverflow.com/questions/6581674/how-do-you-apply-a-valueconverter-to-a-convention-based-caliburn-micro-binding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!