Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
        public void Remove(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.");

            if (child?.Handler?.NativeView is NativeView nativeView)
            {
                nativeView.RemoveFromSuperview();
                TypedNativeView.SetNeedsLayout();
            }
        }