I have an ObservableCollection that I want to bind to my listbox...
lbRosterList.ItemsSource = App.ViewModel.rosterItemsCollection;
However, in that collection I have another collection within it:
[DataMember]
public ObservableCollection<PersonDetail> ContactInfo
{
get
{
return _ContactInfo;
}
set
{
if (value != _ContactInfo)
{
_ContactInfo = value;
NotifyPropertyChanged("ContactInfo");
}
}
}
PersonDetail contains 2 properties: name and e-mail
I would like the listbox to have those values for each item in rosterItemsCollection
RosterId = 0;
RosterName = "test";
ContactInfo.name = "
Art";
ContactInfo.email = "
[email protected]";
RosterId = 0;
RosterName = "test"
ContactInfo.name = "bob";
ContactInfo.email = "
[email protected]";
RosterId = 1;
RosterName = "test1"
ContactInfo.name = "chris";
ContactInfo.email = "
[email protected]";
RosterId = 1;
RosterName = "test1"
ContactInfo.name = "Sam";
ContactInfo.email = "
[email protected]";
I would like that listboxes to display the ContactInfo information.
I hope this makes sense...
My XAML that I've tried with little success:
<listbox x:Name="lbRosterList" ItemsSource="rosterItemCollection">
<textblock x:name="itemText" text="{Binding Path=name}"/>
What am I doing incorrectly?