ObservableCollection
-
I have an ObservableCollection bound to a list box - the collection is essentially ObservableCollection where Person has 2 properties: Name and Age. How do I bind the currently selected item in the listbox to some textboxes (seperate from the ListBox) which show the Name and Age of the Person and allow the Name and Age to be updated using the TextBoxes?
-
I have an ObservableCollection bound to a list box - the collection is essentially ObservableCollection where Person has 2 properties: Name and Age. How do I bind the currently selected item in the listbox to some textboxes (seperate from the ListBox) which show the Name and Age of the Person and allow the Name and Age to be updated using the TextBoxes?
The easy way to do this is to set IsSynchronizedWithCurrentItem="True" on your listview. This way, the currently selected item is synchronised with the collection.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
The easy way to do this is to set IsSynchronizedWithCurrentItem="True" on your listview. This way, the currently selected item is synchronised with the collection.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
check this out http://windowsclient.net/learn/video.aspx?v=149522[^] Its about validation, but also show what you want to do. you can also download the source
Thanks for that, but I already know what to do. I assume you meant to link this to the OP rather than me.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
Thanks for that, but I already know what to do. I assume you meant to link this to the OP rather than me.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
I saw it - thanks.
modified on Monday, May 11, 2009 12:48 PM
-
I have an ObservableCollection bound to a list box - the collection is essentially ObservableCollection where Person has 2 properties: Name and Age. How do I bind the currently selected item in the listbox to some textboxes (seperate from the ListBox) which show the Name and Age of the Person and allow the Name and Age to be updated using the TextBoxes?
Set IsSynchronizedWithCurrentItem="True" I agree :)
Niladri Biswas