RowProperties.Value Property

Gets or sets the value of a row item's data cell when the grid is in Unbound Mode.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v20.1.dll

Declaration

[DefaultValue(null)]
[XtraSerializableProperty]
public object Value { get; set; }
<DefaultValue(Nothing)>
<XtraSerializableProperty>
Public Property Value As Object

Property Value

Type Default Description
Object

null

A Object representing the value associated with a row item.

Remarks

Use the Value property to specify or determine the value associated with a row item when the grid control operates in Unbound Mode. In this mode no data source is associated with the grid and therefore the RowProperties.FieldName property is not in effect. Each row item acquires data to be represented by its single data cell from the Value property.

Since this property is of the Object type, its value can be of any type. After specifying the desired initial value for the Value property, you can assign an editor of the related type for your row item.

Examples

The following example demonstrates how to create a vertical grid control with two editor rows at runtime and specify values for these rows via their RowProperties.Value properties. This example assumes that the editor rows are the children of a category row created programmatically as well. The first editor row uses a check box editor to display its value, while the second uses a combo box.

The image below displays the look and feel of the grid control after the code execution.

RowProperties_Value

using DevExpress.XtraVerticalGrid;
using DevExpress.XtraVerticalGrid.Rows;
using DevExpress.Utils;
using DevExpress.XtraEditors.Repository;

//...

// creating a new vertical grid control
VGridControl vGrid = new VGridControl();
vGrid.Parent = this;
vGrid.Width = 300;
vGrid.RowHeaderWidth = 170;

// creating two editor rows with the specified captions
EditorRow row1 = new EditorRow();
row1.Properties.Caption = "Treat Warnings as Errors";
EditorRow row2 = new EditorRow();
row2.Properties.Caption = "Warning Level";

// creating a new category row and adding it to the grid
CategoryRow category = new CategoryRow("Errors and Warnings");
vGrid.Rows.Add(category);

// adding the editor rows as childs to the category
EditorRow[] rows = {row1, row2};
category.ChildRows.AddRange(rows);

// creating a check editor for the first editor row
RepositoryItemCheckEdit riCheck = vGrid.RepositoryItems.Add("CheckEdit") 
  as RepositoryItemCheckEdit;
row1.Properties.RowEdit = riCheck;
// specifying the row value to be displayed by the associated check editor
row1.Properties.Value = true;

// creating a combobox editor for the second editor row
RepositoryItemComboBox riCombo = vGrid.RepositoryItems.Add("ComboBox") 
  as RepositoryItemComboBox;
// populating the combo box with data
for (int i = 0; i<=4; i++){
    riCombo.Properties.Items.Add("Warning Level " + i.ToString());
}
row2.Properties.RowEdit = riCombo;
// specifying the second row's value
row2.Properties.Value = riCombo.Properties.Items[3];
See Also