Hello, Welcome to Micorosoft Q&A,
UWP:After listview binds data, it flashes when updating data.
The problem is you set the sub listview ItemsSource directly, but not update the different one, for this scenario, the better way is modify the ArrayList as ObservableCollection and update the sub-listview with new datasouce.
private async void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
int ii = 0;
int Max = 5;
var re0a = new result() { re = new ObservableCollection<int> () { 1, 2, 3 } };
await RESULT.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
foreach (Item item in items_list)
{
if (Max >= 10)
{
if (re0a.re.Count < (ii + 1))
re0a.re.Add(1);
else
re0a.re[ii] = 2;
}
if (results.Count < (ii + 1))
results.Add(re0a);
else
results[ii].name = re0a.name;
var diffe0 = re0a.re.Where(c => !results[ii].re.Any(p => p == c)).ToArray();
foreach (var df in diffe0)
{
results[ii].re.Add(df);
}
ii++;
}
});
}
public class Item
{
public string Name { get; set; } = null;
public int cont { get; set; } = 0;
}
public class result : INotifyPropertyChanged
{
private string _name;
public string name
{
get => _name;
set
{
_name = value;
OnPropertyChanged();
}
}
public ObservableCollection<int> re { set; get; }
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.