public void SetElement(VisualElement element)
		{
			ScrollView oldElement = _view;
			_view = (ScrollView)element;

			if (oldElement != null)
			{
				oldElement.PropertyChanged -= HandlePropertyChanged;
				((IScrollViewController)oldElement).ScrollToRequested -= OnScrollToRequested;
			}
			if (element != null)
			{
				OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

				if (_container == null)
				{
					Tracker = new VisualElementTracker(this);
					_container = new ScrollViewContainer(_view, Forms.Context);
				}

				_view.PropertyChanged += HandlePropertyChanged;
				Controller.ScrollToRequested += OnScrollToRequested;

				LoadContent();
				UpdateBackgroundColor();

				UpdateOrientation();

				element.SendViewInitialized(this);

				if (!string.IsNullOrEmpty(element.AutomationId))
					ContentDescription = element.AutomationId;
			}
		}
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            SetElement(null);

            if (disposing)
            {
                Tracker.Dispose();
                Tracker = null;
                RemoveAllViews();
                _container.Dispose();
                _container = null;
            }
        }
Example #3
0
        public void SetElement(VisualElement element)
        {
            ScrollView oldElement = _view;

            _view = (ScrollView)element;

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

                ((IScrollViewController)oldElement).ScrollToRequested -= OnScrollToRequested;
            }
            if (element != null)
            {
                OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

                if (_container == null)
                {
                    Tracker    = new VisualElementTracker(this);
                    _container = new ScrollViewContainer(_view, Context);
                }

                _view.PropertyChanged += HandlePropertyChanged;
                _view.LayoutChanged   += HandleLayoutChanged;

                Controller.ScrollToRequested += OnScrollToRequested;

                LoadContent();
                UpdateBackgroundColor();
                UpdateBackground();
                UpdateOrientation();
                UpdateIsEnabled();
                UpdateHorizontalScrollBarVisibility();
                UpdateVerticalScrollBarVisibility();
                UpdateFlowDirection();

                element.SendViewInitialized(this);

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

            EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);
        }
Example #4
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (disposing)
            {
                SetElement(null);
                Tracker?.Dispose();
                Tracker = null;
                RemoveAllViews();
                _container?.Dispose();
                _container = null;
            }

            base.Dispose(disposing);
        }
        public void SetElement(VisualElement element)
        {
            ScrollView oldElement = _view;

            _view = (ScrollView)element;

            if (oldElement != null)
            {
                oldElement.PropertyChanged -= HandlePropertyChanged;
                ((IScrollViewController)oldElement).ScrollToRequested -= OnScrollToRequested;
            }
            if (element != null)
            {
                OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

                if (_container == null)
                {
                    Tracker    = new VisualElementTracker(this);
                    _container = new ScrollViewContainer(_view, Forms.Context);
                }

                _view.PropertyChanged        += HandlePropertyChanged;
                Controller.ScrollToRequested += OnScrollToRequested;

                LoadContent();
                UpdateBackgroundColor();

                UpdateOrientation();

                element.SendViewInitialized(this);

                if (!string.IsNullOrEmpty(element.AutomationId))
                {
                    ContentDescription = element.AutomationId;
                }
            }
        }
		protected override void Dispose(bool disposing)
		{
			base.Dispose(disposing);

			SetElement(null);

			if (disposing)
			{
				Tracker.Dispose();
				Tracker = null;
				RemoveAllViews();
				_container.Dispose();
				_container = null;
			}
		}