示例#1
0
        /// <summary>
        /// Create a cellVM, can be a cell value or a cell component (button, comobox,...).
        /// </summary>
        /// <param name="cell"></param>
        /// <returns></returns>
        public IGridCellVM CreateCellVM(IGridCell cell)
        {
            // is the cell a value?
            IGridCellValue gridCellValue = cell as IGridCellValue;

            if (gridCellValue != null)
            {
                IGridCellVM cellVM = new GridCellValueVM(gridCellValue);
                return(cellVM);
            }

            // is the cell a checkbox?
            // $TASK-003
            IGridCellCheckBox gridCellCheckBox = cell as IGridCellCheckBox;

            if (gridCellCheckBox != null)
            {
                IGridCellVM cellVM = new GridCellCheckBoxVM(gridCellCheckBox);
                return(cellVM);
            }

            //IGridCellComponent gridCellComponent = cell as IGridCellComponent;
            //if (gridCellComponent != null)
            //{
            //    IGridCellVM cellVM = new GridCellValueVM(cell);
            //    return cellVM;
            //}

            // error or not managed
            return(null);
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="gridCell"></param>
 public GridCellValueVM(IGridCellValue gridCell)
 {
     _gridCell  = gridCell;
     IsReadOnly = _gridCell.IsReadOnly;
     //InitCell();
 }