I'm attempting to use the "new" binding code for ReactiveUI and when I do wire my view model property to my control I get the following error:

Additional information: Can't two-way convert between <type1> and <type2>. To fix this, register a IBindingTypeConverter

So... how do I register an IBindingTypeConverter ? I'm struggling to find an comprehensible example.


n.b. the code that's throwing the error is not relevant to this question, it may in itself be wrong but that is an entirely different issue

有帮助吗?

解决方案

The way to do it is via Splat's service locator:

Locator.CurrentMutable.RegisterConstant(
    new MyCoolTypeConverter(), typeof(IBindingTypeConverter));

Update: If you're using RxUI 5.x, it's "RxApp.CurrentMutable"

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top