/// <summary>
        /// Dispose the specified disposing.
        /// </summary>
        /// <returns>The dispose.</returns>
        /// <param name="disposing">If set to <c>true</c> disposing.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                foreach (var section in Element.Root)
                {
                    if (section.HeaderView != null)
                    {
                        DisposeChildRenderer(section.HeaderView);
                    }
                    if (section.FooterView != null)
                    {
                        DisposeChildRenderer(section.FooterView);
                    }
                }

                foreach (var renderer in _shouldDisposeRenderers)
                {
                    if (renderer.View.Handle != IntPtr.Zero)
                    {
                        renderer.View.RemoveFromParent();
                        renderer.View.Dispose();
                    }
                    renderer.Dispose();
                }
                _shouldDisposeRenderers.Clear();
                _shouldDisposeRenderers = null;

                Control.RemoveItemDecoration(_itemDecoration);
                _parentPage.Appearing -= ParentPageAppearing;
                _adapter?.Dispose();
                _adapter = null;
                _layoutManager?.Dispose();
                _layoutManager = null;
                _simpleCallback?.Dispose();
                _simpleCallback = null;
                _itemTouchhelper?.Dispose();
                _itemTouchhelper = null;

                _itemDecoration?.Dispose();
                _itemDecoration = null;
                _divider?.Dispose();
                _divider = null;

                Element.Root.CollectionChanged -= RootCollectionChanged;
            }
            base.Dispose(disposing);
        }
示例#2
0
 /// <summary>
 /// Dispose the specified disposing.
 /// </summary>
 /// <returns>The dispose.</returns>
 /// <param name="disposing">If set to <c>true</c> disposing.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         _parentPage.Appearing -= ParentPageAppearing;
         _adapter?.Dispose();
         _adapter = null;
         _layoutManager?.Dispose();
         _layoutManager = null;
         _simpleCallback?.Dispose();
         _simpleCallback = null;
         _itemTouchhelper?.Dispose();
         _itemTouchhelper = null;
     }
     base.Dispose(disposing);
 }