, -, , ListView ListBox? , , ListBox. ListBox , , ObservableCollection, / . SelectedValue ListBox Dealer , SelectedDealer.
ListBox, . DataContext ListBox SelectedDealer ItemSource Cars. ListBox , .
/ , ObservableCollection. , - ObservableCollections, . , ObservableCollection SelectedCars . SelectedDealer - :
public ObservableCollection<Car> SelectedCars { get; set; }
private Dealer selectedDealer;
public Dealer SelectedDealer
{
get
{
return this.selectedDealer;
}
set
{
if (this.selectedDealer != value)
{
this.selectedDealer = value;
this.SelectedCars = new ObservableCollection(this.SelectedDealer.Cars);
OnPropertyChanged(() => this.SelectedDealer);
}
}
}
DataContext SelectedDealer, DataContext , . ItemSource SelectedCars.