tags:

views:

78

answers:

1

Dear All!

I have a datagrid which contains bid and ask - prices for currency-symbols. The data is updated every seconds. I update the data by creating a new collection of my viewmodel-entities and bind this collection to the datagrid every second.

The problem is: Because my datagrid contains a template-column with a button "buy", this button is also recreated every second! This means, that when the user hovers the button, the hover-styles blinks, as the button is recreated every second. Additionally sometimes the click-event is not fired correctly, if the button is recreated while the user has his mouse-left-button pressed.

Any suggestions, how to solve real-time-update a datagrid with button-columns?

+1  A: 

Have you looked into the ObservableCollection?

Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed.

This should only refresh those items that are changed, rather than the whole grid.

ChrisF
Thank you for your suggestion! I have already tried to use an ObservableCollection instead of a simple List. The result is the same, because each bid-ask pair is updated every second...So what I would need is something which makes it possible only to refresh the cell and not the whole row.
dlang
@dlang - perhaps you need to make sure that only the changed items are updated rather than the whole list.
ChrisF
@ChrisF: The problem is that every row changes on every update... i want just one column to refresh...
dlang