/// <summary> /// Create a cell (for a row), depending on the column type. /// </summary> /// <param name="column"></param> /// <returns></returns> public IGridCell CreateCell(IDynDataGrid dataGrid, IGridColumn column, IGridRow row) { // create a cell matching the type of the column IGridColumnString colString = column as IGridColumnString; if (colString != null) { // set a default value return(new GridCellString(colString, row, "", dataGrid.GridCellChangedProvider)); } //IGridColumnInt colInt = column as GridColumnInt; //if (colInt != null) //{ // // set a default value // return new GridCellInt(colInt, 0); //} IGridColumnCheckBox colCheckBox = column as IGridColumnCheckBox; if (colCheckBox != null) { return(new GridCellCheckBox(colCheckBox, row, false, dataGrid.GridCellChangedProvider)); } throw new Exception("Factory.CreateCell(): type not yet implemented."); }
/// <summary> /// Check the name of the column. /// </summary> /// <param name="newColName"></param> /// <param name="errCode"></param> /// <returns></returns> //private DynDataGridErrCode CheckColumnName(string newColName) //{ // newColName = newColName.Trim(); // if (string.IsNullOrWhiteSpace(newColName)) // return DynDataGridErrCode.ColumnNameWrong; // if (_collColumnGrid.Where(c=>c.GridColumn.Name.Equals(newColName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault()!=null) // return DynDataGridErrCode.ColumnNameAlreadyUsed; // return DynDataGridErrCode.Ok; //} /// <summary> /// Create Add a new columnVM based on the column model. /// Depends on the type. /// TODO: passer par la grid factory?? /// </summary> /// <param name="column"></param> private IGridColumnVM AddColumnVM(IGridColumn column) { IGridColumnVM columnVM; // is it a string column? IGridColumnString columnString = column as IGridColumnString; if (columnString != null) { columnVM = new GridColumnStringVM(columnString); _collColumnGrid.Add(columnVM); RaisePropertyChanged("CollColumnGrid"); return(columnVM); } // is it a checkbox column? IGridColumnCheckBox columnCheckBox = column as IGridColumnCheckBox; if (columnCheckBox != null) { columnVM = new GridColumnCheckBoxVM(columnCheckBox); _collColumnGrid.Add(columnVM); RaisePropertyChanged("CollColumnGrid"); return(columnVM); } // other type // TODO: throw new Exception("Column type not implemented!"); }
public GridCellString(IGridColumnString column, IGridRow row, string value, GridCellChangedProvider actionProvider) : base(column, row, actionProvider) { Content = value; }
// TODO: besoin? deja présent dans classe de base //IGridColumnString _columnString; public GridColumnStringVM(IGridColumnString columnString) : base(columnString) { //_columnString = columnString; }