如何申请一个ValueConverter到基于惯例,Caliburn.Micro约束力? [英] How do you apply a ValueConverter to a convention-based Caliburn.Micro binding?

查看:243
本文介绍了如何申请一个ValueConverter到基于惯例,Caliburn.Micro约束力?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何申请一个ValueConverter到基于惯例,Caliburn.Micro约束力?或者你需要使用{}绑定语法?

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}" />

但我怎么应用该自定义转换器,如果我使用Caliburn.Micro的约定优于配置,如

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

<TextBlock
    x:Name="Foo" />

谢谢,

推荐答案

您需要更换ConventionManager.ApplyValueConverter FUNC。默认情况下它只做athe布尔=>可见性的转换。另外,还可以取代传统字符串格式化的ApplyStringFormat FUNC。您可以在ConventionManager看看,看看它是如何工作的。

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.

这篇关于如何申请一个ValueConverter到基于惯例,Caliburn.Micro约束力?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆