WPF ComboBox Object Binding - not updating DataContext Object
Posted
by Jaysen
on Stack Overflow
See other posts from Stack Overflow
or by Jaysen
Published on 2010-06-15T21:16:31Z
Indexed on
2010/06/15
23:22 UTC
Read the original article
Hit count: 536
wpf
|wpf-binding
Hello, I have the following scenario:
1 class called 'Widget' with the properties: ID, Code, Description
1 class called 'MyWidget' with a property: m_Widget As Widget
1 ComboBox
The ComboBox has a List(Of Widget) set as the ItemSource.
I create an instance of 'MyWidget' named MyWidget1 and I set the property values of the m_Widget to match one of the items in the 'ComboBox List(Of Widget)'. I then set the DataContext of the ComboBox to MyWidget1.Widget.
When I change the ComboBox selected item, only the ID property of 'MyWidget1.Widget' gets updated...
How do I get the object 'Widget' on 'MyWidget1' to be updated instead of just 'MyWidget1.Widget.ID'?
Here is a link to a sample project demonstrating this scenario:
http://www.webpersona.com/ObjectBinding.zip
Thanks in advance for any help :)
© Stack Overflow or respective owner