0

I am wondering if anyone can help, I am able to bind to a hash table and display values correctly, yet the two-way binding I have specified doesn't update the object when I make changes.

   <DataTemplate x:Key="ResponseItemTemplate">
        <StackPanel Orientation="Horizontal" >
            <TextBox Width="200" Text="{Binding Path=Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
        </StackPanel>
    </DataTemplate>

I don't know if it's anything to do with it being in a DataTemplate?

Vadim Kotov
  • 7,103
  • 8
  • 44
  • 57
  • This question is a duplicate of http://stackoverflow.com/questions/1190440/wpf-two-way-binding-to-a-hash-table/1191002#1191002 – Charlie Jul 28 '09 at 15:36

2 Answers2

1

Enumeration over a Hashtable yields a sequence of DictionaryEntry objects, but DictionaryEntry is a struct, not a class... so you actually get a copy of the DictionaryEntry, so when its value is modified, it doesn't actually modify the entry in the Hashtable.

Thomas Levesque
  • 270,447
  • 59
  • 580
  • 726
0

You have to use {Binding Path=Value.YOURPROPERTYYOUWANTTOMODIFY .... currently you are binding directly to the object which is in the value property.

Martin Moser
  • 5,929
  • 1
  • 23
  • 39