public static void MapContent(IContentViewHandler handler, IContentView page) { if (handler is ContentViewHandler contentViewHandler) { contentViewHandler.UpdateContent(); } }
static void UpdateContent(IContentViewHandler handler) { _ = handler.PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); _ = handler.VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); _ = handler.MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); handler.PlatformView.Children.Clear(); if (handler.VirtualView.PresentedContent is IView view) { handler.PlatformView.Children.Add(view.ToPlatform(handler.MauiContext)); } }
static void UpdateContent(IContentViewHandler handler) { _ = handler.PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); _ = handler.VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); _ = handler.MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); // Cleanup the old view when reused handler.PlatformView.ClearSubviews(); if (handler.VirtualView.PresentedContent is IView view) { handler.PlatformView.AddSubview(view.ToPlatform(handler.MauiContext)); } }
public static void MapContent(IContentViewHandler handler, IContentView page) { UpdateContent(handler); }
public static void MapContent(IContentViewHandler handler, IContentView page) { }
public static void MapBackground(IContentViewHandler handler, IContentView view) { handler.UpdateValue(nameof(handler.ContainerView)); handler.ToPlatform()?.UpdateBackground(view); }