зеркало из https://github.com/DeGsoft/maui-linux.git
Throw exception when ViewCell View is null (#752)
This commit is contained in:
Родитель
81058db4f5
Коммит
97b28b1c20
|
@ -2,6 +2,7 @@ using Android.Content;
|
|||
using Android.Views;
|
||||
using AView = Android.Views.View;
|
||||
using Xamarin.Forms.Internals;
|
||||
using System;
|
||||
|
||||
namespace Xamarin.Forms.Platform.Android
|
||||
{
|
||||
|
@ -32,6 +33,9 @@ namespace Xamarin.Forms.Platform.Android
|
|||
rowHeight = ListView.RowHeightProperty;
|
||||
}
|
||||
|
||||
if (cell.View == null)
|
||||
throw new InvalidOperationException($"ViewCell must have a {nameof(cell.View)}");
|
||||
|
||||
IVisualElementRenderer view = Platform.CreateRenderer(cell.View);
|
||||
Platform.SetRenderer(cell.View, view);
|
||||
cell.View.IsPlatformEnabled = true;
|
||||
|
|
|
@ -139,6 +139,9 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
IVisualElementRenderer GetNewRenderer()
|
||||
{
|
||||
if (_viewCell.View == null)
|
||||
throw new InvalidOperationException($"ViewCell must have a {nameof(_viewCell.View)}");
|
||||
|
||||
var newRenderer = Platform.CreateRenderer(_viewCell.View);
|
||||
_rendererRef = new WeakReference<IVisualElementRenderer>(newRenderer);
|
||||
ContentView.AddSubview(newRenderer.NativeView);
|
||||
|
|
Загрузка…
Ссылка в новой задаче