Hello.
I'm trying to bind a HashSet to a ListView item. I've documented my code here:
public class Person {
public string Name { get; set; }
public AddressList = new AddressList ();
}
public class AddressList : HashSet<Addresses>
{
//
}
public class Addresses {
public string Streetname { get; set; }
public string City { get; set; }
}
public class PersonViewModel : INotifyPropertyChanged {
private Person _person;
public PersonViewModel(Person person)
{
_person= person;
}
public string Name
{
get { return _person.Name; }
set
{
_person.Name = value;
OnPropertyChanged("Name");
}
}
private void OnPropertyChanged(string property)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
}
// This is how I add the DataContext: mainGrid.DataContext = _person //this is a PersonViewModel();
// This is how I bind the DataObjects to the GUI Elements: <TextBox Name="TxtBoxName" Text="{Binding Path=.Name, Mode=TwoWay}"/>
// How can I add in the same way a HashSet to a ListView Element in the WPF Gui? I tried something like {Binding Path=.Name, Mode=TwoWay}
Can anyone help me with tipps how to accomplish that? Thanks a lot!
Cheers