private void AddOperand_Click(object sender, RoutedEventArgs e) { // // Determine parent expression // ExprNode parentExpr; parentExpr = (ExprNode)expressionModel.ExpressionTree.SelectedItem; if (parentExpr == null && ExpressionModel.Count != 0) { return; // Nothing is selected } // // Determine dimension (function) and create child expression // Dim op = (Dim)Operands.SelectedItem; if (op == null) { return; } var expr = ExprNode.CreateProjectExpression(new List <Dim> { FilteredTable.SuperDim, op }, Operation.DOT); // // Insert new child expression // if (parentExpr == null) // First exprssion node { ExpressionModel.Add(expr); } else { if (parentExpr.Input == null) { parentExpr.Input = expr; } else { parentExpr.AddOperand(expr); } } RefreshAll(); }