문제

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