protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context) { Performance.Start(); var cell = (ViewCell)item; var container = convertView as ViewCellContainer; if (container != null) { container.Update(cell); Performance.Stop(); return container; } BindableProperty unevenRows = null, rowHeight = null; if (ParentView is TableView) { unevenRows = TableView.HasUnevenRowsProperty; rowHeight = TableView.RowHeightProperty; } else if (ParentView is ListView) { unevenRows = ListView.HasUnevenRowsProperty; rowHeight = ListView.RowHeightProperty; } IVisualElementRenderer view = Platform.CreateRenderer(cell.View); Platform.SetRenderer(cell.View, view); cell.View.IsPlatformEnabled = true; var c = new ViewCellContainer(context, view, cell, ParentView, unevenRows, rowHeight); Performance.Stop(); return c; }
protected override void DisconnectHandler(AView platformView) { base.DisconnectHandler(platformView); ViewCellContainer c = platformView.GetParentOfType <ViewCellContainer>(); c?.DisconnectHandler(); }
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context) { Performance.Start(out string reference, "GetCellCore"); var cell = (ViewCell)item; var container = convertView as ViewCellContainer; if (container != null) { container.Update(cell); Performance.Stop(reference, "GetCellCore"); return(container); } BindableProperty unevenRows = null, rowHeight = null; if (ParentView is TableView) { unevenRows = TableView.HasUnevenRowsProperty; rowHeight = TableView.RowHeightProperty; } else if (ParentView is ListView) { cell.IsContextActionsLegacyModeEnabled = item.On <PlatformConfiguration.Android>().GetIsContextActionsLegacyModeEnabled(); unevenRows = ListView.HasUnevenRowsProperty; rowHeight = ListView.RowHeightProperty; } if (cell.View == null) { throw new InvalidOperationException($"ViewCell must have a {nameof(cell.View)}"); } var view = (IPlatformViewHandler)cell.View.ToHandler(cell.FindMauiContext()); cell.View.IsPlatformEnabled = true; ViewCellContainer c = view.PlatformView.GetParentOfType <ViewCellContainer>(); if (c != null) { return(c); } c = new ViewCellContainer(context, (IPlatformViewHandler)cell.View.Handler, cell, ParentView, unevenRows, rowHeight); Performance.Stop(reference, "GetCellCore"); return(c); }
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context) { Performance.Start(out string reference, "GetCellCore"); var cell = (ViewCell)item; var container = convertView as ViewCellContainer; if (container != null) { container.Update(cell); Performance.Stop(reference); return(container); } BindableProperty unevenRows = null, rowHeight = null; if (ParentView is TableView) { unevenRows = TableView.HasUnevenRowsProperty; rowHeight = TableView.RowHeightProperty; } else if (ParentView is ListView) { cell.IsContextActionsLegacyModeEnabled = item.On <PlatformConfiguration.Android>().GetIsContextActionsLegacyModeEnabled(); unevenRows = ListView.HasUnevenRowsProperty; rowHeight = ListView.RowHeightProperty; } if (cell.View == null) { throw new InvalidOperationException($"ViewCell must have a {nameof(cell.View)}"); } IVisualElementRenderer view = Platform.CreateRenderer(cell.View, context); Platform.SetRenderer(cell.View, view); cell.View.IsPlatformEnabled = true; var c = new ViewCellContainer(context, view, cell, ParentView, unevenRows, rowHeight); Performance.Stop(reference, "GetCellCore"); return(c); }
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context) { Performance.Start(); var cell = (ViewCell)item; var container = convertView as ViewCellContainer; if (container != null) { container.Update(cell); Performance.Stop(); return(container); } BindableProperty unevenRows = null, rowHeight = null; if (ParentView is TableView) { unevenRows = TableView.HasUnevenRowsProperty; rowHeight = TableView.RowHeightProperty; } else if (ParentView is ListView) { unevenRows = ListView.HasUnevenRowsProperty; rowHeight = ListView.RowHeightProperty; } IVisualElementRenderer view = Platform.CreateRenderer(cell.View); Platform.SetRenderer(cell.View, view); cell.View.IsPlatformEnabled = true; var c = new ViewCellContainer(context, view, cell, ParentView, unevenRows, rowHeight); Performance.Stop(); return(c); }