コード例 #1
0
 public void RecycleCell(object data, DataTemplate dataTemplate, VisualElement parent)
 {
     if (_viewCell == null)
     {
         _viewCell = (dataTemplate.CreateContent() as FastGridCell);
         _viewCell.BindingContext = data;
         _viewCell.Parent         = parent;
         _viewCell.PrepareCell(new Size(Bounds.Width, Bounds.Height));
         _originalBindingContext = _viewCell.BindingContext;
         var renderer = RendererFactory.GetRenderer(_viewCell.View);
         _view = renderer.NativeView;
         _view.AutoresizingMask = UIViewAutoresizing.All;
         _view.ContentMode      = UIViewContentMode.ScaleToFill;
         ContentView.AddSubview(_view);
         return;
     }
     else if (data == _originalBindingContext)
     {
         _viewCell.BindingContext = _originalBindingContext;
     }
     else
     {
         _viewCell.BindingContext = data;
     }
 }
コード例 #2
0
        public GridViewCellContainer(Context context, FastGridCell fastGridCell, global::Android.Views.View parent, Size initialCellSize) : base(context)
        {
            using (var h = new Handler(Looper.MainLooper)) {
                h.Post(() => {
                    _viewCell = fastGridCell;
                    fastGridCell.PrepareCell(initialCellSize);
//					_viewCell.View.BackgroundColor = Xamarin.Forms.Color.Green;
                    var renderer = RendererHelper.GetOrCreateRenderer(fastGridCell.View);
                    _nativeView  = renderer.ViewGroup;
//					SetBackgroundColor (Android.Graphics.Color.Yellow);
                    AddView(_nativeView);
                });
            }
        }
コード例 #3
0
		public GridViewCellContainer (Context context, FastGridCell fastGridCell, global::Android.Views.View parent, Size initialCellSize) : base (context)
		{
			using (var h = new Handler (Looper.MainLooper)) {
				h.Post (() => {
					_parent = parent;
					_viewCell = fastGridCell;
					fastGridCell.PrepareCell (initialCellSize);
//					_viewCell.View.BackgroundColor = Xamarin.Forms.Color.Green;
					var renderer = fastGridCell.View.GetOrCreateRenderer ();
					_nativeView = renderer.ViewGroup;
//					SetBackgroundColor (Android.Graphics.Color.Yellow);
					AddView (_nativeView);
				});
			}

		}
コード例 #4
0
		public void RecycleCell (object data, DataTemplate dataTemplate, VisualElement parent)
		{
			if (_viewCell == null) {
				_viewCell = (dataTemplate.CreateContent () as FastGridCell);
				_viewCell.BindingContext = data;
				_viewCell.Parent = parent;
				_viewCell.PrepareCell (new Size (Bounds.Width, Bounds.Height));
				_originalBindingContext = _viewCell.BindingContext;
				var renderer = RendererFactory.GetRenderer (_viewCell.View);
				_view = renderer.NativeView;
				_view.AutoresizingMask = UIViewAutoresizing.All;
				_view.ContentMode = UIViewContentMode.ScaleToFill;
				ContentView.AddSubview (_view);
				return;
			} else if (data == _originalBindingContext) {
				_viewCell.BindingContext = _originalBindingContext;
			} else {
				_viewCell.BindingContext = data;
			}
		}