using System;
using System.Collections.ObjectModel;
using System.Windows.Forms;

namespace SyncFusionWinform
{
    public partial class Form1 : Form
    {
        private ObservableCollection<Contract> data;
        public Form1()
        {
            InitializeComponent();
            sfDataGrid1.AutoGenerateRelations = true;
            data = new ObservableCollection<Contract>();
            sfDataGrid1.DataSource = data;
            sfDataGrid1.ExpandAllDetailsView();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var a = new Contract()
            {
                FilesName = "efef",
                Status = "ef",
                Invoices = new ObservableCollection<Invoice>()
                          {
                               new Invoice()
                                  {
                                      Amount = 777,
                                      Number = Guid.NewGuid().ToString(),
                                  }
                          }
            };
            data.Add(a);
            sfDataGrid1.ExpandAllDetailsView();
        }
    }
}
