void UpdateContent() { _ = NativeView ?? throw new InvalidOperationException($"{nameof(NativeView)} should have been set by base class."); _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); NativeView.RemoveAllViews(); if (VirtualView.PresentedContent is IView view) { NativeView.AddView(view.ToNative(MauiContext)); } }
public override void SetVirtualView(IView view) { base.SetVirtualView(view); _ = NativeView ?? throw new InvalidOperationException($"{nameof(NativeView)} 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."); NativeView.CrossPlatformMeasure = VirtualView.Measure; NativeView.CrossPlatformArrange = VirtualView.Arrange; NativeView.RemoveAllViews(); //var wrap = ViewGroup.LayoutParams.WrapContent; NativeView.AddView(VirtualView.Content.ToNative(MauiContext)); // , new ViewGroup.LayoutParams(wrap, wrap)); }
public override void SetVirtualView(IView view) { base.SetVirtualView(view); _ = NativeView ?? throw new InvalidOperationException($"{nameof(NativeView)} 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."); NativeView.CrossPlatformMeasure = VirtualView.Measure; NativeView.CrossPlatformArrange = VirtualView.Arrange; NativeView.RemoveAllViews(); if (VirtualView.Content != null) { NativeView.AddView(VirtualView.Content.ToNative(MauiContext)); } }
public override void SetVirtualView(IView view) { base.SetVirtualView(view); _ = NativeView ?? throw new InvalidOperationException($"{nameof(NativeView)} 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."); NativeView.CrossPlatformMeasure = VirtualView.CrossPlatformMeasure; NativeView.CrossPlatformArrange = VirtualView.CrossPlatformArrange; NativeView.RemoveAllViews(); foreach (var child in VirtualView.OrderByZIndex()) { NativeView.AddView(child.ToNative(MauiContext)); } }
protected override void DisconnectHandler(LayoutViewGroup nativeView) { // If we're being disconnected from the xplat element, then we should no longer be managing its chidren NativeView?.RemoveAllViews(); base.DisconnectHandler(nativeView); }