tags:

views:

334

answers:

0

Hi,

How to set DisplayMemberPathProperty and SelectedValuepathProperty for Listbox in codeBehind?

Listbox1.SetBinding(ListBox.ItemsSourceProperty, new Binding { Source = _ItemCollection}); The above line of code works fine and i can see the data in listbox.

But when i try to set the displaymemberpathprop and selectedvaluememberpathprop its not working . I did smtg like this

Listbox1.SetBinding(ListBox.ItemsSourceProperty, new Binding { Source = _ItemCollection}); Listbox1.SetBinding(ListBox.DisplayMemberPathProperty, "FirstName") ; Listbox1.SetBinding(ListBox.SelectedValuePathProperty, "Id");

please help

Thanks Sharath