// customize cells
        public override void CreateCellContent(C1FlexGrid grid, Border bdr, CellRange rng)
        {
            // attach grid event handlers
            SetGrid(grid);

            // get the row/column being created
            var col   = grid.Columns[rng.Column];
            var row   = grid.Rows[rng.Row];
            var field = row.DataItem as FormField;
            var gr    = row as GroupRow;

            // create the cell
            base.CreateCellContent(grid, bdr, rng);
            if (col.BoundPropertyName == "Value" && gr == null)
            {
                if (!string.IsNullOrEmpty(field.Formula))
                {
                    _calculatedStyle.Apply(bdr, SelectedState.None);
                }
                else
                {
                    _editStyle.Apply(bdr, SelectedState.None);
                    if (!field.IsString)
                    {
                        _numberStyle.Apply(bdr, SelectedState.None);
                    }
                }
            }
        }
        /// <summary>
        /// Applies custom styles to the outline row.
        /// </summary>
        public override void ApplyCellStyles(C1FlexGrid grid, CellType cellType, CellRange range, Border bdr)
        {
            if (cellType == CellType.Cell)
            {
                bool hasAlignment = false;

                // get selection state for the range
                var selState = grid.GetSelectedState(range);

                // apply row style
                var row = grid.Rows[range.Row];
                if (row.CellStyle != null)
                {
                    row.CellStyle.Apply(bdr, selState);
                    hasAlignment |= row.CellStyle.HorizontalAlignment.HasValue;
                }

                // apply column style
                var col = grid.Columns[range.Column];
                if (col.CellStyle != null)
                {
                    col.CellStyle.Apply(bdr, selState);
                    hasAlignment |= col.CellStyle.HorizontalAlignment.HasValue;
                }

                // apply cell style
                var xlr = row as ExcelRow;
                if (xlr != null)
                {
                    var s = xlr.GetCellStyle(col);
                    if (s != null)
                    {
                        // leave hyperlink foreground alone...
                        if (bdr.Child is HyperlinkButton)
                        {
                            s.Foreground = null;
                        }

                        // apply standard CellStyle stuff
                        s.Apply(bdr, selState);
                        hasAlignment |= s.HorizontalAlignment.HasValue;

                        // apply general alignment
                        if (!hasAlignment)
                        {
                            var content = grid[range.Row, range.Column];
                            if (IsNumeric(content))
                            {
                                _styleRight.Apply(bdr, selState);
                            }
                        }
                    }
                }
            }
        }