views:

77

answers:

1

Scenario

  • Lets say I use C# WPF, and bind a Dictionary() to a DataGrids datasource.
  • When I update the dictionary will the DataGrid automatically update and refresh?
  • Also, will the DataGrid lose focus whilst doing this?
  • In the event that updating the dictionary does not update the datagrid, how would I go about implementing this?

Help Greatly appreciated, Thanks.

A: 

the datagrid will not update if you use a normal dictionary. Your data structure must notify the world when an item in it changes for it to update the grid. the grid will not, normally, lose focus. Check out Dr. WPF for a nice article on this.

What you need is a dictionary that will pass item updates (not when an item is added/removed).

Muad'Dib