Greetings. We're considering to adopt your suite of components as a standard for our future applications.
At the moment, I'm trying to understand if your WinForms GridView component behavior suits our current workflow.
Consider the following class structure (Master -> each master has "n" Slaves -> each slave has "k" SubSlaves):
public class MasterEntity
{
public Int32 Id { get; set; }
public String Name { get; set; }
public IList<SlaveEntity> Slaves { get; set; }
}
public class SlaveEntity
{
public Int32 Id { get; set; }
public String PropA { get; set; }
public Decimal PropB { get; set; }
public IList<SubSlaveEntity> SubSlaves { get; set; }
}
public class SubSlaveEntity
{
public Int32 Id { get; set; }
public String PropC { get; set; }
}
I assign the dataSource of the grid to an IList<MasterEntity>: as you can see all the lists involved are generic ILists (not BindingLists) and each class doesn't implement the INotifyPropertyChanged interface.
Following the instructions in this page (http://docs.telerik.com/devtools/winforms/gridview/hierarchical-grid/binding-to-hierarchical-data-automatically), I'm able to display the rows in a proper hierarchical grid (through AutoGenerateHierarchy property). I'm also able to properly configure the layout of each column at each hierarchy level.
Now, what I want to achieve is the following:
When I add/delete/edit a row (at each hierarchy level, Master, Slave or SubSlave) I need the changes to be reflected in the grid, without it scrolling to the top or losing the column layout settings. Of course, since we're using normal Lists (not BindingLists) and the entities doesn't implement INotifyPropertyChanged, I know that the grid must be notified of each operation performed on its datasource. At the moment I've only managed to achieve this when I change a property of an entity at the first hierarchy level (Master):
1.
(radGrid.Datasource as IList<
MasterEntity
>)[0].Name = "NEW NAME";
2.
radGrid.TableElement.Update(GridUINotifyAction.DataChanged);
but I also need this to work when I do the following:
1.
(radGrid.Datasource as IList<
MasterEntity
>).Add(new MasterEntity(){ .. });
2.
-> how to notify the grid about the new master entity?
1.
(radGrid.Datasource as IList<
MasterEntity
>)[0].Slaves[0].PropA = "NEW PROP A VALUE";
2.
-> how to notify the grid about the change in a property value in that slave entity?
1.
(radGrid.Datasource as IList<
MasterEntity
>)[0].Slaves.Add(new SlaveEntity(){ .. });
2.
-> how to notify the grid about the new slave entity in the first master entity?
..and so on, I need to be able to perform ADD / DELETE / CHANGE ENTITY PROPERTIES at each hierarchy level and properly notify the grid about each operation, while keeping the current column layout (at each hierarchy level) and without the grid scrolling to the top.
Thanks for the kind help.