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 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 System.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.

Example
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 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.

C# |
using DevExpress.XtraVerticalGrid;
using DevExpress.XtraVerticalGrid.Rows;
using DevExpress.Utils;
using DevExpress.XtraEditors.Repository;
VGridControl vGrid = new VGridControl();
vGrid.Parent = this;
vGrid.Width = 300;
vGrid.RowHeaderWidth = 170;
EditorRow row1 = new EditorRow();
row1.Properties.Caption = "Treat Warnings as Errors";
EditorRow row2 = new EditorRow();
row2.Properties.Caption = "Warning Level";
CategoryRow category = new CategoryRow("Errors and Warnings");
vGrid.Rows.Add(category);
EditorRow[] rows = {row1, row2};
category.ChildRows.AddRange(rows);
RepositoryItemCheckEdit riCheck = vGrid.RepositoryItems.Add("CheckEdit")
as RepositoryItemCheckEdit;
row1.Properties.RowEdit = riCheck;
row1.Properties.Value = true;
RepositoryItemComboBox riCombo = vGrid.RepositoryItems.Add("ComboBox")
as RepositoryItemComboBox;
for (int i = 0; i<=4; i++){
riCombo.Properties.Items.Add("Warning Level " + i.ToString());
}
row2.Properties.RowEdit = riCombo;
row2.Properties.Value = riCombo.Properties.Items[3];
|
VB |
Imports DevExpress.XtraVerticalGrid
Imports DevExpress.XtraVerticalGrid.Rows
Imports DevExpress.Utils
Imports DevExpress.XtraEditors.Repository
Dim VGrid As New VGridControl()
VGrid.Parent = Me
VGrid.Width = 300
VGrid.RowHeaderWidth = 170
Dim Row1 As New EditorRow()
Row1.Properties.Caption = "Treat Warnings as Errors"
Dim Row2 As New EditorRow()
Row2.Properties.Caption = "Warning Level"
Dim Category As New CategoryRow("Errors and Warnings")
VGrid.Rows.Add(Category)
Dim Rows() As EditorRow = {Row1, Row2}
Category.ChildRows.AddRange(Rows)
Dim RICheck As RepositoryItemCheckEdit = CType(VGrid.RepositoryItems.Add("CheckEdit"), _
RepositoryItemCheckEdit)
Row1.Properties.RowEdit = RICheck
Row1.Properties.Value = True
Dim RICombo As RepositoryItemComboBox = CType(VGrid.RepositoryItems.Add("ComboBox"), _
RepositoryItemComboBox)
Dim I As Integer
For I = 0 To 4
RICombo.Properties.Items.Add("Warning Level " + I.ToString())
Next
Row2.Properties.RowEdit = RICombo
Row2.Properties.Value = RICombo.Properties.Items(3)
|