// ** overrides
        public override void CreateCellContent(C1FlexGrid grid, Border bdr, CellRange rng)
        {
            var col = grid.Columns[rng.Column];

            // use check boxes for boolean columns
            if (col.DataType == typeof(bool))
            {
                var val       = grid[rng.Row, rng.Column];
                var checkCell = new CheckCell(val is bool?(bool)val: false);
                bdr.Child = checkCell;
                return;
            }

            // use images for FaultType columns
            if (col.DataType == typeof(FaultType))
            {
                var val       = grid[rng.Row, rng.Column];
                var faultCell = new FaultCell(val is FaultType ? (FaultType)val : FaultType.None);
                bdr.Child = faultCell;
                return;
            }

            // use radio buttons for TestType columns
            if (col.DataType == typeof(TestType))
            {
                var val      = grid[rng.Row, rng.Column];
                var testCell = new TestTypeCell(val is TestType ? (TestType)val : TestType.Linear);
                bdr.Child = testCell;
                return;
            }

            // allow default factory
            base.CreateCellContent(grid, bdr, rng);
        }
Esempio n. 2
0
        // ** overrides
        public override void CreateCellContent(C1FlexGrid grid, Border bdr, CellRange rng)
        {
            var col = grid.Columns[rng.Column];

            // use check boxes for boolean columns
            if (col.DataType == typeof(bool))
            {
                var val = grid[rng.Row, rng.Column];
                var checkCell = new CheckCell(val is bool ? (bool)val : false);
                bdr.Child = checkCell;
                return;
            }

            // use images for FaultType columns
            if (col.DataType == typeof(FaultType))
            {
                var val = grid[rng.Row, rng.Column];
                var faultCell = new FaultCell(val is FaultType ? (FaultType)val : FaultType.None);
                bdr.Child = faultCell;
                return;
            }

            // use radio buttons for TestType columns
            if (col.DataType == typeof(TestType))
            {
                var val = grid[rng.Row, rng.Column];
                var testCell = new TestTypeCell(val is TestType ? (TestType)val : TestType.Linear);
                bdr.Child = testCell;
                return;
            }

            // allow default factory
            base.CreateCellContent(grid, bdr, rng);
        }