我正在研究Xamarin.Forms项目,并添加了一个bool值来启用/禁用默认情况下在ios中显示的额外单元格。
我的自定义渲染器是
public class CustomListView : ListView
{
public static readonly BindableProperty ShowExtraCellsProperty =
BindableProperty.Create("ShowExtraCells", typeof(bool), typeof(CustomListView), true);
public bool ShowExtraCells
{
get
{
return (bool)GetValue(ShowExtraCellsProperty);
}
set
{
SetValue(ShowExtraCellsProperty, value);
}
}
}
而我的iOS渲染器是
public class CustomListViewiOS : ListViewRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
{
var listView = Control as UITableView;
listView.SeparatorInset = UIEdgeInsets.Zero;
this.Control.TableFooterView = new UIView();
}
}
}
我的问题是我找不到发送方将其强制转换为CustomListView以能够获取属性的值。
相关分类