public void Add(IView child) { _ = TypedNativeView ?? throw new InvalidOperationException($"{nameof(TypedNativeView)} should have been set by base class."); _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); TypedNativeView.AddView(child.ToNative(MauiContext), 0); }
public override void SetVirtualView(IView view) { base.SetVirtualView(view); _ = TypedNativeView ?? throw new InvalidOperationException($"{nameof(TypedNativeView)} should have been set by base class."); _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); TypedNativeView.CrossPlatformMeasure = VirtualView.Measure; TypedNativeView.CrossPlatformArrange = VirtualView.Arrange; foreach (var child in VirtualView.Children) { TypedNativeView.AddView(child.ToNative(MauiContext)); } }
public override void SetView(View view) { base.SetView(view); var newContent = VirtualView?.View?.ToView(); if (_content == null || newContent != _content) { if (_content != null) TypedNativeView.RemoveView(_content); _content = newContent; if (_content != null) TypedNativeView.AddView(_content); } }