Ejemplo n.º 1
0
        void OnRootCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                if (e.NewStartingIndex == -1 || e.NewItems == null)
                {
                    goto case NotifyCollectionChangedAction.Reset;
                }
                AddSection(e);
                break;

            case NotifyCollectionChangedAction.Remove:
                if (e.OldStartingIndex == -1)
                {
                    goto case NotifyCollectionChangedAction.Reset;
                }
                RemoveSection(e);
                break;

            case NotifyCollectionChangedAction.Replace:     // no support on Android.
            case NotifyCollectionChangedAction.Move:
            case NotifyCollectionChangedAction.Reset:
                FillProxy();
                _adapter.NotifyDataSetChanged();
                break;
            }
        }
 /// <summary>
 /// Ons the element property changed.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">E.</param>
 protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     base.OnElementPropertyChanged(sender, e);
     if (e.PropertyName == SettingsView.SeparatorColorProperty.PropertyName) {
         UpdateSeparatorColor();
         Control.InvalidateItemDecorations();
     }
     else if (e.PropertyName == SettingsView.BackgroundColorProperty.PropertyName) {
         UpdateBackgroundColor();
     }
     else if (e.PropertyName == TableView.RowHeightProperty.PropertyName) {
         UpdateRowHeight();
     }
     else if (e.PropertyName == SettingsView.UseDescriptionAsValueProperty.PropertyName) {
         _adapter.NotifyDataSetChanged();
     }
     else if (e.PropertyName == SettingsView.SelectedColorProperty.PropertyName) {
         //_adapter.NotifyDataSetChanged();
     }
     else if (e.PropertyName == SettingsView.ShowSectionTopBottomBorderProperty.PropertyName) {
         //_adapter.NotifyDataSetChanged();
         Control.InvalidateItemDecorations();
     }
     else if (e.PropertyName == TableView.HasUnevenRowsProperty.PropertyName) {
         _adapter.NotifyDataSetChanged();
     }
     else if (e.PropertyName == SettingsView.ScrollToTopProperty.PropertyName){
         UpdateScrollToTop();
     }
     else if (e.PropertyName == SettingsView.ScrollToBottomProperty.PropertyName){
         UpdateScrollToBottom();
     }
 }
 void UpdateRowHeight()
 {
     if (Element.RowHeight == -1) {
         Element.RowHeight = 60;
     }
     else {
         _adapter?.NotifyDataSetChanged();
     }
 }