绑定到Text属性IOS-统一不工作 [英] Binding to Text property ios-unified not working
问题描述
我更新了我的xamarin IOS-项目,以统一的API(支持64位)。一切都如预期。该项目构建和运作。
不过,我发现一个问题。结合到UILabel.Text属性将不再工作。所有其他绑定仍在工作(对UIButton.Hidden属性例如)。这里是我的code:
//创建绑定
VAR套= this.CreateBindingSet< MyView的,MyViewModel>();
set.Bind(labelitem)//不工作
。对于(T => t.Text)
。要(V => v.MyStringValue);
set.Bind(buttonitem)//工作
。对于(B = GT; b.Hidden)
。要(V => v.MyboolValue)
.WithConversion(新InverseBoolValueConverter());
set.Apply();
我使用MvvmCross的绑定。 Bevore统一更新一切正常。
首先,我试图改变的链接器选项为不链接。同样的问题。
谁能解释一下我,什么的发生?谢谢
修改
我发现在输出信息在调试时我的项目:
弱目标为空在MvxUILabelTextTargetBinding - 跳过集
块引用>解决方案有一些,有些人看到的问题,其他人都没有,在最新的Xamarin稳定版本(VS和XS之间也许不同的新的GC - 目前还不清楚......)。您可以在 https://github.com/MvvmCross/MvvmCross/issues/902阅读这些一>(上<一一些背景href=\"http://stackoverflow.com/questions/28263138/migrating-to-unified-api-and-new-reference-counting\">Migrating以统一的API和新的引用计数)
有在 HTTP来解决这些尝试:// slodge .blogspot.co.uk / 2015/02/351-α-release.html - 请不要尝试阿尔法的包,看他们是否帮助
。如果不是,那么唯一的解决办法接受,现在是促进你的
的UILabel
在您查看私有变量。I updated my xamarin ios-project to the unified API (64 Bit support). Everything worked as expected. The project builds and works.
But I detected one problem. The binding to UILabel.Text properties won't work anymore. All other bindings are still working (to a UIButton.Hidden property for example). Here is my code:
// Create bindings var set = this.CreateBindingSet<MyView, MyViewModel>(); set.Bind(labelitem) // not working .For(t => t.Text) .To(v => v.MyStringValue); set.Bind(buttonitem) // working .For(b => b.Hidden) .To(v => v.MyboolValue) .WithConversion(new InverseBoolValueConverter()); set.Apply();
I'm using MvvmCross for the bindings. Bevore the unified-update everything worked fine.
First I tried to change the Linker-Option to "don't link". Same problem.
Can anyone explain me, what's happen? Thanks
Edit
I found a info in the output while debugging my project:
Weak Target is null in MvxUILabelTextTargetBinding - skipping set
解决方案There are some issues that some people are seeing, others are not, with the new GC in the latest Xamarin "stable" releases (maybe differences between VS and XS - it's not clear...). You can read about these on https://github.com/MvvmCross/MvvmCross/issues/902 (with some background on Migrating to Unified API and new reference counting)
There's an attempt to address these in http://slodge.blogspot.co.uk/2015/02/351-alpha-release.html - please do try the alpha packages to see if they help.
If not, then the only accepted workaround right now is to promote your
UILabel
to a private variable in your View.这篇关于绑定到Text属性IOS-统一不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!