Separation of data from interface is one of the unique features of .Net Grid. Since the same data can be used in one or more grids, it reduces memory consumption and simplifies application structure. This data can be presented in different ways in different grids on different hierarchy levels and can be sorted or filtered in different ways.
Methods of data addition may also vary. Data can be inserted by calling Grid.Rows.Add()/Row.Add() methods or by connecting data collections via Grid.DataSource. Programmers can work with this data in the same way using filtering, sorting and grouping.
To demonstrate it, let’s review an example of using the same data on different hierarchy levels that is inserted in two grids with different methods and hierarchies. These grids can be displayed and edited separately and all changes made in one grid will be correctly displayed in another grid without complex synchronization methods.
To change data presentation in cells it is sufficient to set the required editors and formats while data may remain the same.
C# | Copy |
---|---|
//grid1: set custom editors and formats grid1.Headers[0]["IntValue3"].Editor = new BulletComboEditor(); grid1.Headers[0]["IntValue3"].Format = new BulletFormat(); grid1.Headers[0]["BoolValue"].Editor = new CheckBoxEditor(); grid1.Headers[0]["IntValue4"].Editor = new UpDownNumericEditor(); //grid2: set custom editors and formats grid2.Headers[1]["IntValue1"].Editor = new TrackBarEditor(0, 99); grid2.Headers[1]["IntValue2"].Format = new HexFormat(true, true); grid2.Headers[1]["IntValue3"].Editor = new BulletEditor(); grid2.Headers[1]["BoolValue"].Editor = new IconBoolEditor(); grid2.Headers[1]["IntValue4"].Editor = new UpDownNumericEditor(); |