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) { CarouselScrollView oldElement = _view; _view = (CarouselScrollView)element; if (oldElement != null) { ((IScrollViewController)oldElement).ScrollToRequested -= OnScrollToRequested; } if (element != null) { ElementChanged?.Invoke(this, new VisualElementChangedEventArgs(oldElement, element)); if (_container == null) { Tracker = new VisualElementTracker(this); _container = new CustomScrollViewContainer(_view, Context); } Controller.ScrollToRequested += OnScrollToRequested; LoadContent(); UpdateBackgroundColor(); UpdateOrientation(); UpdateIsEnabled(); UpdateHorizontalScrollBarVisibility(); UpdateVerticalScrollBarVisibility(); UpdateFlowDirection(); if (!string.IsNullOrEmpty(element.AutomationId)) { ContentDescription = element.AutomationId; } } }