protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == "ItemsSource") { _adapter.Items = Element.ItemsSource; } else if (e.PropertyName == FormsGridView.PaddingProperty.PropertyName) { var grid = sender as FormsGridView; int pad = (int)((double)grid.GetValue(JWChinese.GridView.PaddingProperty)); _recyclerView.SetPadding(pad, 0, pad, pad); } // if (e.PropertyName == "IsScrollEnabled") { // Device.BeginInvokeOnMainThread (() => { // _recyclerView.Enabled = Element.IsScrollEnabled; //// Debug.WriteLine ("scroll enabled changed to " + _gridCollectionView.ScrollEnabled); // } // ); // } }
void CreateRecyclerView() { _recyclerView = new ScrollRecyclerView(global::Android.App.Application.Context); _recyclerView.SetClipToPadding(false); _recyclerView.Touch += _recyclerView_Touch; var scrollListener = new GridViewScrollListener(Element, _recyclerView); _recyclerView.AddOnScrollListener(scrollListener); var grid = Element as FormsGridView; int pad = (int)((double)grid.GetValue(JWChinese.GridView.PaddingProperty)); _recyclerView.SetPadding(pad, 0, pad, pad); _recyclerView.SetItemAnimator(null); _recyclerView.HorizontalScrollBarEnabled = false; _recyclerView.VerticalScrollBarEnabled = true; _adapter = new GridViewAdapter(Element.ItemsSource, _recyclerView, Element, Resources.DisplayMetrics); _recyclerView.SetAdapter(_adapter); UpdateGridLayout(); }