I'm developing a prototype application that resembles kind of a dashboard type application. An example would be a computer network. The dashboard would display information about each computer. So a grid with rows, but instead of a grid the rows are display more as a set of tiles. My application is not monitoring computers so it's limited to about 30 rows/tiles. I've created a user control for each tile and am using a DataTemplate bound to a dataset to display the tiles. The user can resize the screen the the tiles "fit" because they are in a wrappanel. The user can double-click on a tile to get more details.

Another difference between the computer network and my particular application is that I will be requesting updates (refreshing the dataset) every second. Yes, every second. The best way I could find to do this was to refill the dataset and reset the ItemsSource of the ItemsControl.

moDataAdapter.Fill(moDataset, "SampleTable")

Me.Tiles.ItemsSource = New DataView(moDataset.Tables(0))

However I'm currently struggling with the fact that the user control (tile) will be re-drawn every time I refresh the dataset (every second). I understand that's probably the behavior the ItemsControl should provide, but is there any way get around re-rendering the user control and still use data-binding

Thanks in advance,


Re: Windows Presentation Foundation (WPF) Bound ItemsControl Rerenders on Refresh

Kent Boogaart

Hi Matt,

You could leverage observable collections. When you bind to an observable collection, you can modify the collection instead of recreating it and only the relevant parts of the UI will be updated. Of course, you may need more complex logic in your update code to ensure you:
1. Add any new elements
2. Remove any stale elements
3. Find and modify and modified elements

Finally, each data item in your collection will need to implement INotifyPropertyChanged so that any changes to properties cause the UI to refresh.


Re: Windows Presentation Foundation (WPF) Bound ItemsControl Rerenders on Refresh

Marco Zhou - MSFT

As Kent indicates that instead of using DataTable as the container for data, You'd better use ObservableCollection to hold the data, and each data item should implement INotifyPropertyChanged, Because resetting binding On ItemsSource each time you change the source collection are relatively expensive. So basically, you need to change your data access code to construct the custom data entity objects instead of traditional DataRow and DataTable metaphors. There are many good ORM tools avaiable on the web. So doing this should not be so paintful as it is without ORM code generators

Hope this helps

Re: Windows Presentation Foundation (WPF) Bound ItemsControl Rerenders on Refresh


Thanks to both Marco and Kent.

I was afraid that would be the answer. It's not a bad answer but populating an object (that implements INotifyPropertyChanged) from a dataset then binding the UI to the object seems like overkill for this particular app. It's read-only so the object wouldn't serve much of a purpose. For now I am manually populating the UI with the dataset; well, I'm sending each DataRow to the usercontrol where the fields are manually populated.

Re: Windows Presentation Foundation (WPF) Bound ItemsControl Rerenders on Refresh


You can also use "LINQ to SQL Classes" instead. Drag and drop in VS2008 and the collection and entity objects will be created for you, allready hooked up with the INotifyPropertyChanged eventhandlers.

I didn¡¯t read the whole thread but it seemed obvious that's the way to go.

Here is a few links that might be of help.