public IList <Control> getControls(string type) { List <Control> controlList = new List <Control>(); GridConfiguration columnConfirgurations = _gridConfiguraitonRepository.getConfiguration(type); foreach (ColumnConfiguration item in columnConfirgurations.columnConfigurations) { switch (item.dataType) { case DataType.Integer: controlList.Add(TextBoxForNumber(item.dataType, item.id)); break; case DataType.Float: controlList.Add(TextBoxForNumber(item.dataType, item.id)); break; case DataType.Enum: controlList.Add(DropDown(item.enumValues.Select(x => x.value).ToArray(), item.id)); break; default: throw new FormatException("Data Type Not Found"); } } currentState = type; _controlList = controlList; return(controlList); }
private void ReturnedGrid_AutoGeneratedColumns(object sender, EventArgs e) { DataGrid dataGrid = (sender as DataGrid); var configs = _gridConfiguraitonRepository.getConfiguration(dataGrid.Name).columnConfigurations.ToList(); var columns = dataGrid.Columns.ToList(); foreach (var column in columns) { var order = configs.Where(x => x.id == column.Header.ToString()).Select(x => x.order).FirstOrDefault(); column.DisplayIndex = order; column.Header = configs.Where(x => x.id == column.Header.ToString()).Select(x => x.Name).FirstOrDefault(); } }