【发布时间】:2019-11-19 23:48:48
【问题描述】:
我有一个问题,当我使用列表项时,如果它们是可见区域,listview 不会重绘它们,仅在我将元素滚动出视图并返回之后才会反映,或者我已经点击了项目,它更新到 Xamarin v4 后出现,当我使用 Xamarin v3 时,一切都很好
此视频中的错误https://youtu.be/u-a1cWKywKI
模型.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;
}
【问题讨论】:
标签: c# listview xamarin.forms xamarin.android