Hi,
Im currently playing with this component as part of an evaluation to see if we can use it with our products. My scenario is maybe weird but hopefully someone can throw me an idea or 2 based on what i want to do :
Here is the scenario :
1. I have a XamGrid bound to some data (the data is dynamic so its not predetemined what columns i will have - so i cannot assume a fixed set of columns with fixed types).
2. Based on a set of conditions i want to set 2 different specific cell's ( lets call them Cell A and Cell B) values to be part of a calculation and a Cell C should display a value based on a formula.
So formula : C = A + B
Cell C should display the result of this calculation. Cell A and Cell B are cells that I am able to identify in for example the xamgrid's CellControlAttached event..
Is there any way to use the XamCalculationManager to "register" these cells and add this to a calculation manager runtime so that If i edit in Cell A or Cell B the value of Cell C will change accordingly ?
regards
Øyvind
Sorry for the late reply, but I have managed to create a workaround for this. I created a value converter to use the XamCalculationManager like this:
public class EquationConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return typeof(EquationConverter) .GetMethod("RunEquaton") .MakeGenericMethod(value.GetType()).Invoke(this, new object[] { value, parameter }); }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return value; }
public static object RunEquaton<T>(T obj, string equation) { return (new XamCalculationManager()).CalculateFormula<T>(obj, equation).Value; } }
I can now easily add a column to my XamGrid in code and pass it the equation to be used. like this:
grid.Columns.Add(new UnboundColumn() { HeaderText = headerText, Key = key, ValueConverter = new EquationConverter(), ValueConverterParameter = Equation });
Hope this helps :D
Øyvind,
I got similar requirement. Have you got any solution for this problem? I am evaluating Infragistics XamCalculationManager & xamgrid controls. I am building xamgrid columns in runtime (dynamically) and I wanted to use xamcalculationmanager to build formulas (like excel) and apply to the results in the grid.
Please let me know if any solution for this problem.
thanks,
Sanjay (sdusari@gmail.com)
Hi Sandip,
Thanks for the answer, though i had an impression that it would be supported from the descriptions of the "New features in 11.2". I only have one question :
Are there plans for making the XamCaldulationManager supported by the XamGrid ? This would make an amazing addition to the XamGrid as ingrid dynamic calculations are needed by many LOB applications.
As the component is brand new - i would be happy to supply you guys with an example of how the functionality of the XamCalculationManager would be relevant for the XamGrid if you are in need of "motivation" on where to take the component in the next steps ;)
Hi ojohnsen,
Currently XamGrid doesn't support using calculation manager with it.
Let me know if you have any questions.
Sandip