コード例 #1
0
        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.");

            TypedNativeView.AddSubview(child.ToNative());
            TypedNativeView.SetNeedsLayout();
        }
コード例 #2
0
        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.");
            _ = MauiApp.Current?.Context ?? throw new InvalidOperationException($"The MauiApp.Current.Context can't be null.");

            TypedNativeView.AddSubview(child.ToNative(MauiApp.Current.Context));
            TypedNativeView.SetNeedsLayout();
        }
コード例 #3
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.");

            TypedNativeView.CrossPlatformMeasure = VirtualView.Measure;
            TypedNativeView.CrossPlatformArrange = VirtualView.Arrange;

            foreach (var child in VirtualView.Children)
            {
                TypedNativeView.AddSubview(child.ToNative());
            }
        }