|
TWaver.Controls.Table component implements System.Windows.Controls.DataGrid, realizes on conbination with DataBox. This chapter will introduce the usage of table, the definition of table column, the customize of renderer and editor, the usage of filter and sorting order. Let's show properties Name,isSingle and color for Table component: DataBox<Data> box = new DataBox<Data>(); int i = 0; while (i++ < 10) { Data data = new Data(); data.Name = "" + i; data.SetClient("age", Utils.RandomInt(30)); data.SetClient("isSingle", Utils.RandomBool()); data.SetClient("color", Utils.RandomColor()); box.Add(data); } Table<Data> table = new Table<Data>(box); DataGridColumn column = new TableTextColumn(Consts.PROPERTY_TYPE_ACCESSOR, "Name", "Name"); table.Columns.Add(column); column = new TableCheckBoxColumn(Consts.PROPERTY_TYPE_CLIENT, "isSingle", "Is Single"); table.Columns.Add(column); column = new TableColorColumn(Consts.PROPERTY_TYPE_CLIENT, "color", "Color"); table.Columns.Add(column); this.LayoutRoot.Children.Add(table);
|
