I want to implement a datagrid, which will be filled every 5min.
But, first code: XAML:
dataGrid1.Items.refresh();
to update the contents of DataGrid
I gues this cause binding is not aware that you changed collection. I would suggest, or:
GetEmployees()
you every time create a new one.or
null
or an empty collection and after actually assign a new one. or
EDIT
ObservableEmployee <UIEmployee> list = new ObservableEmployee <UIEmployee>(); //move list to global variables and declare it as ObservableCollection
public ObservableEmployee GetEmployees()
{
//here only return an instance of list
return list;
}
//this method call when you want to update data on gri
public void UpdateMyList() {
//clear list
list.Clear();
//after add all data
list.Ad(..);
list(..);
.
.
}
UpdateTarget
like provided in folowing example: DataBinding Refresh in WPFOr, you could just null ItemsSource
out and initialised it again:
dataGridView.ItemsSource = null;
dataGridView.ItemsSource = ItemsSourceObjects;