protected override void Dispose(bool disposing) { base.Dispose(disposing); SetElement(null); if (disposing) { Tracker.Dispose(); Tracker = null; RemoveAllViews(); _container.Dispose(); _container = null; } }
public void SetElement(VisualElement element) { ScrollView oldElement = _view; _view = (ScrollView)element; if (oldElement != null) { oldElement.PropertyChanged -= HandlePropertyChanged; _view.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.ScrollToRequested += OnScrollToRequested; LoadContent(); UpdateBackgroundColor(); UpdateOrientation(); UpdateIsEnabled(); //element.SendViewInitialized(this); if (!string.IsNullOrEmpty(element.AutomationId)) { ContentDescription = element.AutomationId; } } Xamarin.Forms.Internals.EffectUtilities.RegisterEffectControlProvider(this, oldElement, element); }