title: WPF: How to create a collection that can be bound to
body: <p>My app has a background thread that periodically retrieves data from an external source, in the form of key/value pairs. I would like to expose this data for binding, presumably by storing them in some kind of static(?) model, as the data will be needed by numerous views throughout my app. There are potentially hundreds of these keys, and may be different for each customer, so I can't simply create an INotifyPropertyChanged model with a property for each value.</p>
  
  <p>The app has multiple views visible at any one time, and each of these will have numerous controls (usually textboxes) that I want to bind to individual items in the above collection. When a value in the collection is updated, any controls bound to <em>only</em> that item should change to reflect the new value. I'm assuming an <code>ObservableCollection</code> wouldn't be suitable here, as a change to a single item will result in all controls updating, regardless of which item they are bound to?</p>
  
  <p>To throw a further complexity into the mix, some values (which are numeric) will need formatting for display, e.g. number of decimal places, or adding a suffix such as "volts". The formatting rules are user-defined so I can't hardcode them into (say) the XAML binding's <code>StringFormat</code> expression. Ideally I should be able to access both the raw value (e.g. for calculations), and the formatted version (for display purposes). I'm sure it must be possible to achieve the latter using some clever WPF feature!</p>
  
  <p>I would appreciate any pointers on how I can solve these requirements.</p>
  
  <p><strong>Edit</strong>: it's worth mentioning that I've previously tried implementing the model as some kind of collection. The problem is that it won't be initially populated with all values, and these only get added some time later. When they <em>do</em> eventually get added, a bound control doesn't update - presumably because it wasn't initially able to bind to the missing value.</p>