Skip to content

DevExpress-Examples/winforms-treelist-expression-editor-xpview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms TreeList - Create calculated columns (Expression Editor and XPView)

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.

Files to Review

Documentation

See Also

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)