Ejemplo n.º 1
0
        private SpannedDataColumn CreateColumn(CoveredCellInfo cc, int index, int heightIncrementation, int widthIncrementation)
        {
            var dc = new SpannedDataColumn
            {
                ColumnIndex = index,
                RowSpan     = heightIncrementation,
                ColumnSpan  = widthIncrementation,
                // WPF-19238- if grid has no columns and summary row is added, need to set null for grid column
                GridColumn          = this.DataGrid.Columns.Count > 0 ? this.DataGrid.Columns[ResolveToGridColumnIndex(index)] : null,
                RowIndex            = this.RowIndex,
                SelectionController = this.DataGrid.SelectionController
            };

            if (this.RowType == RowType.TableSummaryRow || this.RowType == RowType.TableSummaryCoveredRow)
            {
                dc.Renderer = this.DataGrid.CellRenderers["TableSummary"];
            }
            else if (this.RowType == RowType.CaptionRow || this.RowType == RowType.CaptionCoveredRow)
            {
                dc.Renderer = this.DataGrid.CellRenderers["CaptionSummary"];
            }
            else if (this.RowType == Grid.RowType.HeaderRow)
            {
                if (dc.RowIndex < this.DataGrid.GetHeaderIndex())
                {
                    dc.GridColumn = null;
                    dc.Renderer   = this.DataGrid.CellRenderers["StackedHeader"];
                    this.RowData  = this.DataGrid.StackedHeaderRows[this.RowIndex].StackedColumns.FirstOrDefault(col => col.HeaderText == cc.Name);
                }
                else
                {
                    dc.Renderer = this.DataGrid.CellRenderers["Header"];
                }
            }
            else //(this.RowType == RowType.SummaryRow || this.RowType == RowType.SummaryCoveredRow)
            {
                dc.Renderer = this.DataGrid.CellRenderers["GroupSummary"];
            }

            dc.InitializeColumnElement(this.RowData, false);
#if WPF
            if (DataGrid.useDrawing && dc.ColumnElement is GridCell)
            {
                (dc.ColumnElement as GridCell).UseDrawing = DataGrid.useDrawing;
            }
#endif
            return(dc);
        }
Ejemplo n.º 2
0
        protected override DataColumnBase CreateIndentColumn(int index)
        {
            DataColumnBase dc = new SpannedDataColumn();

            dc.IsIndentColumn      = true;
            dc.IsEnsured           = true;
            dc.IsEditing           = false;
            dc.RowIndex            = this.RowIndex;
            dc.ColumnIndex         = index;
            dc.GridColumn          = null;
            dc.SelectionController = this.DataGrid.SelectionController;
            if (this.RowRegion == Grid.RowRegion.Header && this.RowType == Grid.RowType.HeaderRow)
            {
                dc.ColumnElement = new GridHeaderIndentCell()
                {
                    ColumnBase = dc
                }
            }
            ;
            else
            {
                dc.InitializeColumnElement(this.RowData, false);
            }
            if (this.RowType == RowType.TableSummaryRow || this.RowType == RowType.TableSummaryCoveredRow)
            {
                (dc.ColumnElement as GridIndentCell).ColumnType = IndentColumnType.InTableSummaryRow;
                dc.IndentColumnType = IndentColumnType.InTableSummaryRow;
            }
#if WPF
            if (this.DataGrid.useDrawing)
            {
                (dc.ColumnElement as GridCell).UseDrawing = DataGrid.useDrawing;
            }
#endif
            return(dc);
        }