Reputation: 1517
How can I refresh a Silverlight listbox or datagrid? When I bind items the listbox or datagrid doesn't refresh until I click inside the control. This is annoying as I cannot see added items runtime.
Upvotes: 0
Views: 1771
Reputation: 137188
You need to use an ObservableCollection
and Dependency Properties.
By doing this the collection informs the view that it's changed so that the view can refresh itself.
From the ObservableCollection
page:
Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed.
The area is a little large to go into in an answer on Stack Overflow, but there is plenty of information about these on the MSDN and other questions asked here. If, after reviewing the documentation, you have a specific question post that.
Upvotes: 1