The bound collection property has to be public, or it won't bind.
public class MainWindow: Window, INotifyPropertyChanged
{
private ObservableCollection<AddCustomer.Customer> customers;
public ObservableCollection<AddCustomer.Customer> Customers { get; set; }
public MainWindow()
{
this.InitializeWindow();
this.DataContext = this;
this.Customers = new ObservableCollection<AddCustomer.Customer>()
{
new AddCustomer.Customer(){ },
};
}
}
Set the
ItemsSource
in your XAML. You can use a
List instead
of an
ObservableCollection
, but if you do, you lose the ability of the
GridView
to update itself when the collection changes.