In this example, the WinForms TreeList control is bound to a collection of persistent objects. The example demonstrates how to add/create view properties (ViewProperty) on the fly using ConditionExpressionEditorForm
and add coresponding calculated columns:
void OnShowExpressionEditorClick(object sender, EventArgs e) {
using (ExpressionEditorForm editor =
new ConditionExpressionEditorForm(new TreeListDataColumnInfo(treeList1.Columns), null)) {
if (editor.ShowDialog() == DialogResult.OK) {
using (InputForm input = new InputForm()) {
input.ShowDialog();
xpView1.AddProperty(input.ColumnName, editor.Expression);
treeList1.PopulateColumns();
}
}
}
}
- Run the project.
- Click the Show Expression Editor button.
- Create an expression (for example, "[Quantity] * [UnitPrice]").
- Click OK.
- Specify the name of a new calculated column (for example, "Total").
- Click OK.
(you will be redirected to DevExpress.com to submit your response)