public DataGridView(DataGridBase grid) : base(grid) { Func <DataPanelView <CGContext>, CGContext> f = (DataPanelView <CGContext> p) => { return(UIGraphics.GetCurrentContext()); }; var g = (IDataGrid <CGContext>)grid; g.Setup( (IScrollablePanel <CGContext> dg) => { if (dg != null) { var p = new ScrollableDataPanelView <CGContext> (dg, f); AddSubview(p); } }, (IRegularPanel <CGContext> dg) => { if (dg != null) { var p = new DataPanelView <CGContext> (dg, f); AddSubview(p); } } ); // TODO addview? }
protected override void OnElementChanged(ElementChangedEventArgs <Zumero.DataGrid.XF.DataGridBase> e) { base.OnElementChanged(e); // TODO if (Element) _container = new FivePanelsView(Element); Func <DataPanelView <IGraphics>, IGraphics> f = (DataPanelView <IGraphics> p) => { IGraphics gr = new CrossGraphics.CoreGraphics.CoreGraphicsGraphics( UIGraphics.GetCurrentContext(), true, p.Bounds.Height); return(gr); }; (Element as IDataGrid <IGraphics>).Setup( (IScrollablePanel <IGraphics> dg) => { if (dg != null) { var p = new ScrollableDataPanelView <IGraphics> (dg, f); p.BackgroundColor = Element.BackgroundColor.ToUIColor(); _container.AddSubview(p); } }, (IRegularPanel <IGraphics> dg) => { if (dg != null) { var p = new DataPanelView <IGraphics> (dg, f); p.BackgroundColor = Element.BackgroundColor.ToUIColor(); _container.AddSubview(p); } } ); if (e.OldElement != null) { e.OldElement.PropertyChanged -= OnElementPropertyChanged; } e.NewElement.PropertyChanged += OnElementPropertyChanged; SetNativeControl(_container); }
protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs <Zumero.DataGrid.XF.DataGridBase> e) { base.OnElementChanged(e); _container = new FivePanelsView(Context, Element); Func <Canvas, IGraphics> f = (Canvas cv) => { IGraphics gr = new CrossGraphics.Android.AndroidGraphics(cv); return(gr); }; (Element as IDataGrid <IGraphics>).Setup( (IScrollablePanel <IGraphics> p) => { if (p != null) { var pv = new ScrollableDataPanelView <IGraphics> (Context, p, f); // no backgrounds. slow. //pv.SetBackgroundColor(Element.BackgroundColor.ToAndroid ()); _container.AddView(pv); } }, (IRegularPanel <IGraphics> p) => { if (p != null) { var pv = new DataPanelView <IGraphics>(Context, p, f); // no backgrounds. slow. //pv.SetBackgroundColor(Element.BackgroundColor.ToAndroid ()); _container.AddView(pv); } } ); if (e.OldElement == null) { SetNativeControl(_container); } }