title: General Observable Dictionary Class for DataBinding/WPF C#
body: <p>I'm trying to create a Observable Dictionary Class for WPF DataBinding in C#.
  I found a nice example from Andy here: <a href="https://stackoverflow.com/questions/800130/two-way-data-binding-with-a-dictionary-in-wpf/800217">Two Way Data Binding With a Dictionary in WPF</a></p>
  
  <p>According to that, I tried to change the code to following:</p>
  
  <pre><code>class ObservableDictionary : ViewModelBase
  {
      public ObservableDictionary(Dictionary&lt;TKey, TValue&gt; dictionary)
      {
          _data = dictionary;
      }
  
      private Dictionary&lt;TKey, TValue&gt; _data;
  
      public Dictionary&lt;TKey, TValue&gt; Data
      {
          get { return this._data; }
      }
  
      private KeyValuePair&lt;TKey, TValue&gt;? _selectedKey = null;
      public KeyValuePair&lt;TKey, TValue&gt;? SelectedKey
      {
          get { return _selectedKey; }
          set
          {
              _selectedKey = value;
              RaisePropertyChanged("SelectedKey");
              RaisePropertyChanged("SelectedValue");
          }
      }
  
      public TValue SelectedValue
      {
          get
          {
              return _data[SelectedKey.Value.Key];
          }
          set
          {
              _data[SelectedKey.Value.Key] = value;
              RaisePropertyChanged("SelectedValue");
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Unfortunately I still don't know how to pass "general" Dictionary Objects.. any ideas?</p>
  
  <p>Thank you!</p>
  
  <p>Cheers</p>