N
N
Nicholas2014-04-19 21:24:23
Android
Nicholas, 2014-04-19 21:24:23

C#, linking array of objects and ListView?

Greetings!
I didn't write anything for a long time, I fell out of fashionable and new trends in programming, but the need forced me :)
What is:
-Project in C# .net 4.5
-An array of class instances with a set of string/int/... variables
-ListView.
The array is updated with some periodicity, it is necessary that after updating the array, the listview elements also change, but only those that change in the array.
There is a standard approach "on the forehead" - the flag "was changed" on the array element, running through the array and changing the listview element associated with it.
But there is a feeling that this is not quite the right approach.
Actually the question is how to connect an array of some elements and a sheet?
ps - played a little with Java for Android - there is a great opportunity to use list adapter'a - if the data set attached to the sheet changes, the sheet changes. Is there something similar for C#?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Doshevsky, 2014-04-19
@MikhailD

Use ObservableCollection and data binding:
<ListView ItemsSource="{Binding MyData}">

A
Alexander, 2014-04-21
@Papagatto

Maybe look towards the implementation of the INotifyPropertyChanged interface ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question