Beispiel #1
0
        public void SetElement(VisualElement element)
        {
            var oldElement = Element;

            Element = element;

            ViewControllers = new[] { _flyoutController = new EventedViewController(), _detailController = new ChildViewController() };

            if (!Forms.IsiOS9OrNewer)
            {
                Delegate = _innerDelegate = new InnerDelegate(FlyoutPage.FlyoutLayoutBehavior);
            }

            UpdateControllers();

            _flyoutController.DidAppear     += FlyoutControllerDidAppear;
            _flyoutController.WillDisappear += FlyoutControllerWillDisappear;

            PresentsWithGesture = FlyoutPage.IsGestureEnabled;
            OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

            EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);

            if (element != null)
            {
                element.SendViewInitialized(NativeView);
            }
        }
        public void SetElement(VisualElement element)
        {
            var oldElement = Element;

            Element = element;

            ViewControllers = new[] { _masterController = new EventedViewController(), _detailController = new ChildViewController() };

            Delegate = _innerDelegate = new InnerDelegate(MasterDetailPage.MasterBehavior);

            UpdateControllers();

            _masterController.WillAppear    += MasterControllerWillAppear;
            _masterController.WillDisappear += MasterControllerWillDisappear;

            PresentsWithGesture = MasterDetailPage.IsGestureEnabled;

            OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

            EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);

            if (element != null)
            {
                element.SendViewInitialized(NativeView);
            }
        }
Beispiel #3
0
        public void SetElement(VisualElement element)
        {
            var oldElement = Element;

            Element = element;

            FinishedCustomizingViewControllers += HandleFinishedCustomizingViewControllers;
            Tabbed.PropertyChanged             += OnPropertyChanged;
            Tabbed.PagesChanged += OnPagesChanged;

            OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

            OnPagesChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));

            if (element != null)
            {
                element.SendViewInitialized(NativeView);
            }

            //disable edit/reorder of tabs
            CustomizableViewControllers = null;

            UpdateBarBackgroundColor();
            UpdateBarTextColor();

            EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);
        }
Beispiel #4
0
        public void SetElement(VisualElement element)
        {
            _requestedScroll = null;
            var oldElement = Element;

            Element = element;

            if (oldElement != null)
            {
                oldElement.PropertyChanged -= HandlePropertyChanged;
                ((ScrollView)oldElement).ScrollToRequested -= OnScrollToRequested;
            }

            if (element != null)
            {
                element.PropertyChanged += HandlePropertyChanged;
                ((ScrollView)element).ScrollToRequested += OnScrollToRequested;
                if (_packager == null)
                {
                    _packager = new VisualElementPackager(this);
                    _packager.Load();

                    _tracker = new VisualElementTracker(this);
                    _tracker.NativeControlUpdated += OnNativeControlUpdated;
                    _events = new EventTracker(this);
                    _events.LoadEvents(this);

                    _insetTracker = new KeyboardInsetTracker(this, () => Window, insets => ContentInset = ScrollIndicatorInsets = insets, point =>
                    {
                        var offset = ContentOffset;
                        offset.Y  += point.Y;
                        SetContentOffset(offset, true);
                    });
                }

                UpdateDelaysContentTouches();
                UpdateContentSize();
                UpdateBackgroundColor();
                UpdateIsEnabled();
                UpdateVerticalScrollBarVisibility();
                UpdateHorizontalScrollBarVisibility();

                _shellScrollTracker = new ShellScrollViewTracker(this);

                OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

                EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);

                if (element != null)
                {
                    element.SendViewInitialized(this);
                }

                if (!string.IsNullOrEmpty(element.AutomationId))
                {
                    AccessibilityIdentifier = element.AutomationId;
                }
            }
        }
Beispiel #5
0
        public void SetElement(TElement element)
        {
            var oldElement = Element;

            Element = element;

            if (oldElement != null)
            {
                oldElement.PropertyChanged -= _propertyChangedHandler;
            }

            if (element != null)
            {
                if (element.BackgroundColor != Color.Default || (oldElement != null && element.BackgroundColor != oldElement.BackgroundColor))
                {
                    SetBackgroundColor(element.BackgroundColor);
                }

                UpdateClipToBounds();

                if (_tracker == null)
                {
                    _tracker = new VisualElementTracker(this);
                    _tracker.NativeControlUpdated += (sender, e) => UpdateNativeWidget();
                }

                if (AutoPackage && _packager == null)
                {
                    _packager = new VisualElementPackager(this);
                    _packager.Load();
                }

                if (AutoTrack && _events == null)
                {
                    _events = new EventTracker(this);
                    _events.LoadEvents(this);
                }

                element.PropertyChanged += _propertyChangedHandler;
            }

            OnElementChanged(new ElementChangedEventArgs <TElement>(oldElement, element));

            if (element != null)
            {
                SendVisualElementInitialized(element, this);
            }

            EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);

            if (Element != null && !string.IsNullOrEmpty(Element.AutomationId))
            {
                SetAutomationId(Element.AutomationId);
            }
        }
Beispiel #6
0
        public void SetElement(VisualElement element)
        {
            var oldElement = Element;

            if (oldElement != null)
            {
                oldElement.PropertyChanged -= HandlePropertyChanged;
            }

            if (element != null)
            {
                Element = element;
                Element.PropertyChanged += HandlePropertyChanged;

                if (_packager == null)
                {
                    WebView.EvalRequested += OnEvalRequested;
                    WebView.EvaluateJavaScriptRequested += OnEvaluateJavaScriptRequested;
                    WebView.GoBackRequested             += OnGoBackRequested;
                    WebView.GoForwardRequested          += OnGoForwardRequested;
                    WebView.ReloadRequested             += OnReloadRequested;
                    NavigationDelegate = new CustomWebViewNavigationDelegate(this);
                    UIDelegate         = new CustomWebViewUIDelegate();

                    BackgroundColor = UIColor.Clear;

                    AutosizesSubviews = true;

                    _tracker = new VisualElementTracker(this);

                    _packager = new VisualElementPackager(this);
                    _packager.Load();

                    _events = new EventTracker(this);
                    _events.LoadEvents(this);
                }

                Load();
            }

            OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

            EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);

            if (Element != null && !string.IsNullOrEmpty(Element.AutomationId))
            {
                AccessibilityIdentifier = Element.AutomationId;
            }

            if (element != null)
            {
                element.SendViewInitialized(this);
            }
        }
		public void SetElement(VisualElement element)
		{
			var oldElement = Element;
			Element = element;
			OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

			if (element != null)
				element.SendViewInitialized(NativeView);

			EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);
		}
Beispiel #8
0
		public void SetElement(VisualElement element)
		{
			VisualElement oldElement = Element;
			Element = element;
			UpdateTitle();

			OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

			if (element != null)
			{
				if (!string.IsNullOrEmpty(element.AutomationId))
					SetAutomationId(element.AutomationId);

				element.SendViewInitialized(NativeView);
			}

			EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);
		}
Beispiel #9
0
        public void SetElement(VisualElement element)
        {
            VisualElement oldElement = Element;

            Element = element;
            UpdateTitle();

            OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

            _pageLifecycleManager = new PageLifecycleManager(Element as IPageController);

            if (element != null)
            {
                if (!string.IsNullOrEmpty(element.AutomationId))
                {
                    SetAutomationId(element.AutomationId);
                }

                element.SendViewInitialized(NativeView);

                var parent = Element.Parent;

                while (!Application.IsApplicationOrNull(parent))
                {
                    if (parent is ShellContent)
                    {
                        _isInItems = true;
                    }

                    if (parent is ShellSection shellSection)
                    {
                        _shellSection = shellSection;
                        ((IShellSectionController)_shellSection).AddContentInsetObserver(this);

                        break;
                    }

                    parent = parent.Parent;
                }
            }

            EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);
        }
		public void SetElement(VisualElement element)
		{
			var oldElement = Element;
			Element = element;
			Element.SizeChanged += PageOnSizeChanged;

			_masterController = new ChildViewController();
			_detailController = new ChildViewController();

			_clickOffView = new UIView();
			_clickOffView.BackgroundColor = new Color(0, 0, 0, 0).ToUIColor();

			Presented = ((MasterDetailPage)Element).IsPresented;

			OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

			EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);

			if (element != null)
				element.SendViewInitialized(NativeView);
		}