【问题标题】:xamarin - propagate the change of a bindable property to the ios rendererxamarin - 将可绑定属性的更改传播到 ios 渲染器
【发布时间】:2017-07-11 18:19:49
【问题描述】:
我创建了一个自定义控件作为带有可绑定属性的 EntryCell 的扩展。
我通过扩展 EntryCellRenderer 在 ios 上实现了渲染器。
当可绑定属性更改时,我想更改渲染器的属性。
EntryCellRenderer 有一个静态 Methode OnCellPropertyChanged,我无法在我的渲染器中覆盖它。
任何想法我怎么能做到这一点?
非常感谢您的帮助
【问题讨论】:
标签:
xamarin
xamarin.ios
xamarin.ios-binding
【解决方案1】:
听起来像是您可以在自定义渲染器中覆盖的 OnElementPropertyChanged 方法的确切原因。
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) {
base.OnElementPropertyChanged(sender, e);
if(e.PropertyName == CustomEntryCell.MyCustomThingProperty.PropertyName) { //Make sure to check against your BinableProperty.PropertyName like I am doing here
//Make your change here
}
}