为了账号安全,请及时绑定邮箱和手机立即绑定

在ListViewRenderer中获取绑定的属性

在ListViewRenderer中获取绑定的属性

C#
守着一只汪 2021-04-02 10:13:33
我正在研究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以能够获取属性的值。
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 159 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信