Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

OnPropertyChanged sometimes does not update UI in ListView, only after scroll or another activity

$
0
0

i have a problem, when i work with list items, listview does not redraw them if they area of visibility, reflected only after I've scrolled the element out of view and back, or I've tap on item, it appeared after the updated to Xamarin v4, when i used Xamarin v3 everything was good

i have video this bug but I cant add link ((

Model.cs

     bool _CheckBoxIsVisible = false;
                public bool CheckBoxIsVisible
                {
                    get
                    {
                        return _CheckBoxIsVisible;
                    }
                    set
                    {
                        if (_CheckBoxIsVisible != value)
                        {
                            _CheckBoxIsVisible = value;
                            OnPropertyChanged("CheckBoxIsVisible");
                        }
                    }
                }

        #region INotifyPropertyChanged Implementation
                public event PropertyChangedEventHandler PropertyChanged;
                void OnPropertyChanged([CallerMemberName] string propertyName = "")
                {
                    if (PropertyChanged == null)
                        return;

                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
                }
                #endregion

container.xaml

<controls:CheckBox Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" Margin="5,0,5,0" Type="Check" IsVisible="{Binding CheckBoxIsVisible}" IsChecked="{Binding IsSelect}" VerticalOptions="Center" HorizontalOptions="Center" />

container.cs

    public ObservableCollection<MailModel> Items = new ObservableCollection<MailModel>();
        MailItemsListView.ItemsSource = Items;


    foreach (var item in Items)
                        {
                            item.CheckBoxIsVisible= true;
                        }

Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>