I've got a windows form with a Devexpress GridControl whos Datasource is bound to FleetPreference.ManufacturerList
where ManufacturerList
is a BindingList<ManufacturerItem>
and FleetPreference
is a public property on the form.
i.e.
public class FleetPreference : FleetPreferenceBase
{
////
////
////
}
public class FleetPreferenceBase
{
public BindingList<ManufacturerItem> ManufacturerList { get; set; }
}
public class Form1
{
public FleetPreference FleetPreference { get; set; }
public BindingList<ManufacturerItem> ManufacturerList { get; set; }
public Form1()
{
this.gridControl1.DataSource =
FleetPreference.ManufacturerList; // doesn't auto-update grid
this.gridControl1.DataSource =
ManufacturerList; // does auto-update grid
}
}
When adding a new item to the collection by calling FleetPreference.ManufacturerList.AddNew()
this adds a new item to the original list, but the GridControl's datasource is not updated.
Upon doing some checking, when I add a new BindingList<ManufacturerItem>
property to the form and bind the control to this property, the auto-update works as expected.
Is there any reason why using a nested Property would not behave as expected with automatically providing refresh events back to the GridControl?
you can use
PopulateColumns()
to grid view after setting data source.