コード例 #1
0
 public static void MapContent(IContentViewHandler handler, IContentView page)
 {
     if (handler is ContentViewHandler contentViewHandler)
     {
         contentViewHandler.UpdateContent();
     }
 }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
 public static void MapContent(IContentViewHandler handler, IContentView page)
 {
     UpdateContent(handler);
 }
コード例 #5
0
 public static void MapContent(IContentViewHandler handler, IContentView page)
 {
 }
コード例 #6
0
 public static void MapBackground(IContentViewHandler handler, IContentView view)
 {
     handler.UpdateValue(nameof(handler.ContainerView));
     handler.ToPlatform()?.UpdateBackground(view);
 }