/// <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;
         Control?.Selector?.Dispose();
         _adapter?.Dispose();
         _adapter = null;
     }
     base.Dispose(disposing);
 }
        /// <summary>
        /// Ons the element changed.
        /// </summary>
        /// <param name="e">E.</param>
        protected override void OnElementChanged(ElementChangedEventArgs <SettingsView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                var listview = new AListView(Context);
                SetNativeControl(listview);

                Control.Focusable = false;
                Control.DescendantFocusability = DescendantFocusability.AfterDescendants;
                Control.SetDrawSelectorOnTop(true);

                UpdateSelectedColor();
                UpdateBackgroundColor();
                UpdateRowHeight();

                _adapter        = new SettingsViewAdapter(Context, e.NewElement, Control);
                Control.Adapter = _adapter;

                //hide Divider
                Control.DividerHeight = 0;
                Control.Divider       = null;
                Control.SetFooterDividersEnabled(false);
                Control.SetHeaderDividersEnabled(false);

                Element elm = Element;
                while (elm != null)
                {
                    elm = elm.Parent;
                    if (elm is Page)
                    {
                        break;
                    }
                }

                _parentPage            = elm as Page;
                _parentPage.Appearing += ParentPageAppearing;
            }
        }