Пример #1
0
            public ModalContainer(
                IMauiContext windowMauiContext,
                Page modal,
                ViewGroup parentView)
                : base(windowMauiContext?.Context ?? throw new ArgumentNullException($"{nameof(windowMauiContext.Context)}"))
            {
                _windowMauiContext = windowMauiContext;
                Modal = modal;

                _backgroundView = new AView(_windowMauiContext.Context);
                UpdateBackgroundColor();
                AddView(_backgroundView);

                Id = AView.GenerateViewId();

                _modalFragment   = new ModalFragment(_windowMauiContext, modal);
                _fragmentManager = _windowMauiContext.GetFragmentManager();

                parentView.AddView(this);

                _fragmentManager
                .BeginTransaction()
                .Add(this.Id, _modalFragment)
                .Commit();

                UpdateMargin();
            }
Пример #2
0
            public ModalContainer(IWindow window, Page modal) : base(window.Handler?.MauiContext?.Context ?? throw new ArgumentNullException($"{nameof(window.Handler.MauiContext.Context)}"))
            {
                _windowMauiContext = window.Handler.MauiContext;
                Modal = modal;

                _backgroundView = new AView(_windowMauiContext.Context);
                UpdateBackgroundColor();
                AddView(_backgroundView);

                Id = AView.GenerateViewId();

                Modal.PropertyChanged += OnModalPagePropertyChanged;

                _modalFragment   = new ModalFragment(_windowMauiContext, modal);
                _fragmentManager = _windowMauiContext.GetFragmentManager();

                _fragmentManager
                .BeginTransaction()
                .Add(this.Id, _modalFragment)
                .Commit();
            }