Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
475
Howto calculate in code behind?
posted

Hello,

I try to use your xamFormulaEditor, but I don't know how to achieve what I want, because there is no sample that fits.

What I'm trying to do is:

Step 1: Edit a formula string via xamFormulaEditor, where the operands should be 1 to n double values from an array.

Step 2: Store this string to disk. (no problem)

Step 3: Later on the program should pick up the formula string and do the calulation.

The problems are

Step 1: How can I tell the editor that there are n operands? The number of available operands will vary.

Step 3: What do I have to do in order to calculate my formula with my actual operands? There is no dialog window available at this moment.

 

Please could someone give me a small sample as a starter?

Maybe something with these two functions:

void OpenEditor(ref string formulaString, int numberOfOperands)   // opens window to edit the formula

double Calc(string formulaString, double[] operands)   // calculates the formula with the given operands

Parents
  • 34810
    Offline posted

    Hello Michael,

    I have attached a sample where you input a number into a textbox to specify the number of arguments for a specific function named MyAvg.

    After that, you need to open the FormulaEditor dialog window by pressing a button, which will update the function with the correct amount of arguments. Then it will calculate the average of the given operands.

    Also, here is a link to the online documentation for the FormulaEditor: http://help.infragistics.com/Doc/WPF/Current/CLR4.0/?page=xamFormulaEditor.html

    Please let me know if you have any questions or concerns.

    Sincerely,
    Andrew
    Developer Support I
    Infragistics Inc.
    www.infragistics.com/support

    FormulaEditorNArgs.zip
Reply Children