BrightIdeasSoftware.ObjectListView.FillInValues C# (CSharp) Method

FillInValues() protected method

Fill in the given OLVListItem with values of the given row
protected FillInValues ( OLVListItem lvi, object rowObject ) : void
lvi OLVListItem the OLVListItem that is to be stuff with values
rowObject object the model object from which values will be taken
return void
        protected virtual void FillInValues(OLVListItem lvi, object rowObject)
        {
            if (this.Columns.Count == 0)
                return;

            OLVListSubItem subItem = this.MakeSubItem(rowObject, this.GetColumn(0));
            lvi.SubItems[0] = subItem;
            lvi.ImageSelector = subItem.ImageSelector;

            // Only Details and Tile views have subitems
            switch (this.View) {
                case View.Details:
                    for (int i = 1; i < this.Columns.Count; i++) {
                        lvi.SubItems.Add(this.MakeSubItem(rowObject, this.GetColumn(i)));
                    }
                    break;
                case View.Tile:
                    for (int i = 1; i < this.Columns.Count; i++) {
                        OLVColumn column = this.GetColumn(i);
                        if (column.IsTileViewColumn)
                            lvi.SubItems.Add(this.MakeSubItem(rowObject, column));
                    }
                    break;
                default:
                    break;
            }

            // Give the item the same font/colors as the control
            lvi.Font = this.Font;
            lvi.BackColor = this.BackColor;
            lvi.ForeColor = this.ForeColor;

            // Set the check state of the row, if we are showing check boxes
            if (this.CheckBoxes) {
                CheckState? state = this.GetCheckState(lvi.RowObject);
                if (state.HasValue)
                    lvi.CheckState = state.Value;
            }

            // Give the RowFormatter a chance to mess with the item
            if (this.RowFormatter != null) {
                this.RowFormatter(lvi);
            }
        }
ObjectListView