public static void MapContent(IBorderHandler handler, IBorderView border) { if (handler is BorderHandler borderHandler) { borderHandler.UpdateContent(); } }
static void UpdateContent(IBorderHandler handler) { _ = handler.PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); _ = handler.MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); _ = handler.VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); handler.PlatformView.RemoveAllViews(); if (handler.VirtualView.PresentedContent is IView view) { handler.PlatformView.AddView(view.ToPlatform(handler.MauiContext)); } }
static void UpdateContent(IBorderHandler 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(); handler.PlatformView.EnsureBorderPath(); if (handler.VirtualView.PresentedContent is IView view) { handler.PlatformView.Content = view.ToPlatform(handler.MauiContext); } }
static void UpdateContent(IBorderHandler 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 var oldChildren = handler.PlatformView.Subviews.ToList(); oldChildren.ForEach(x => x.RemoveFromSuperview()); if (handler.VirtualView.PresentedContent is IView view) { handler.PlatformView.AddSubview(view.ToPlatform(handler.MauiContext)); } }
public static void MapContent(IBorderHandler handler, IBorderView border) { }
public static void MapWidth(IBorderHandler handler, IBorderView border) { handler.PlatformView?.UpdateWidth(border); handler.PlatformView?.InvalidateBorderStrokeBounds(); }