Example #1
0
        internal override TreeDataColumnBase CreateColumn(int index)
        {
            var dc = new TreeDataColumn();

            dc.DataRow     = this;
            dc.ColumnIndex = index;
            var columnIndex = this.TreeGrid.ResolveToGridVisibleColumnIndex(index);

            dc.TreeGridColumn = this.TreeGrid.Columns[columnIndex];
            if (this.RowIndex < this.TreeGrid.HeaderLineCount && this.RowIndex >= 0)
            {
                dc.Renderer  = this.TreeGrid.CellRenderers["Header"];
                this.RowData = this.TreeGrid.Columns[columnIndex];
            }
            else
            {
                dc.Renderer = dc.TreeGridColumn.CellType != string.Empty
                               ? this.TreeGrid.CellRenderers[dc.TreeGridColumn.CellType]
                               : this.TreeGrid.CellRenderers["Static"];
            }

            if (this.RowType == TreeRowType.DefaultRow)
            {
                var expanderColumnIndex = TreeGrid.expanderColumnIndex;
                if (expanderColumnIndex == index)
                {
                    dc.ColumnType = TreeColumnType.ExpanderColumn;
                }
            }
            else if (this.RowType == TreeRowType.HeaderRow)
            {
                dc.ColumnType = TreeColumnType.ColumnHeader;
            }

            dc.InitializeColumnElement(this.RowData, false);
            if (dc.ColumnType == TreeColumnType.ExpanderColumn)
            {
                var expanderCell = dc.ColumnElement as TreeGridExpanderCell;
                UpdateExpanderCellProperties(expanderCell);
            }
            SetCellBindings(dc);
            if (dc.TreeGridColumn.GridValidationMode != GridValidationMode.None)
            {
                if (this.RowIndex >= this.TreeGrid.headerLineCount)
                {
                    this.TreeGrid.ValidationHelper.ValidateColumn(this.RowData, dc.TreeGridColumn.MappingName, dc.ColumnElement as TreeGridCell, new RowColumnIndex(dc.RowIndex, dc.ColumnIndex));
                }
            }
            return(dc);
        }
Example #2
0
        internal virtual void CreateRowHeaderColumn(int index)
        {
            var dc = new TreeDataColumn();

            dc.IsEnsured      = true;
            dc.DataRow        = this;
            dc.ColumnIndex    = index;
            dc.TreeGridColumn = null;
            dc.Renderer       = this.TreeGrid.CellRenderers["RowHeader"];
            dc.ColumnType     = TreeColumnType.RowHeader;
            if (this.RowIndex >= 0 && this.RowIndex <= this.TreeGrid.GetHeaderIndex())
            {
                dc.Renderer      = null;
                dc.ColumnElement = new TreeGridRowHeaderIndentCell();
            }
            else
            {
                dc.InitializeColumnElement(this.RowData, false);
            }

            this.VisibleColumns.Add(dc);
            ApplyRowHeaderVisualState();
        }