I am creating my data grid clomns dynamically. Each have different data type and precision value.
My Parameter class
public class Parameter { public string ParameterName { get; set; } public double Value { get; set; } public Type Type { get; set; } public string Precision { get; set; } }
Colum initialization
void xamDataGrid_FieldLayoutInitialized(object sender, Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs e) { SpreadsheetViewModel.MyViewModel columns = this.ViewModel.Data.First(); for (int i = 0; i < columns.Parameters.Count; i++) { var field = new UnboundField { Name = columns.Parameters[i].ParameterName, BindingMode = BindingMode.TwoWay, DataType = columns.Parameters[i].Type, Format = columns.Parameters[i].Precision, BindingPath = new PropertyPath("Parameters[" + i + "].Value"), AllowEdit = false, }; field.Settings.EditAsType = typeof(String); e.FieldLayout.Fields.Add(field); } }
If I manually set DataType = typeof(double ) it has no problem, but when I send same thing though parameter it gives an error
What might be the reason ?
Thank you for your reply, It looks like I missed somrthing, I found out the problem, You can delete the topic :)