Пример #1
0
        void UpdateContent()
        {
            _ = PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class.");
            _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class.");
            _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class.");

            // Cleanup the old view when reused
            PlatformView.ClearSubviews();

            if (VirtualView.PresentedContent is IView view)
            {
                PlatformView.AddSubview(view.ToPlatform(MauiContext));
            }
        }
Пример #2
0
        void UpdateIndicator()
        {
            if (VirtualView is ITemplatedIndicatorView iTemplatedIndicatorView)
            {
                var    indicatorsLayoutOverride = iTemplatedIndicatorView.IndicatorsLayoutOverride;
                UIView?handler;
                if (MauiContext != null && indicatorsLayoutOverride != null)
                {
                    ClearIndicators();
                    handler = indicatorsLayoutOverride.ToPlatform(MauiContext);
                    PlatformView.AddSubview(handler);
                }
            }

            void ClearIndicators()
            {
                foreach (var child in PlatformView.Subviews)
                {
                    child.RemoveFromSuperview();
                }
            }
        }