I am dynamically building the field layout for the XamDataPresenter and I need to add a converter to a field. All the examples I find show how to do it with xaml I need to add the converter in code, C#. Here is the code that I am using to define the field layout
//create a field
Infragistics.Windows.DataPresenter.Field field = new Infragistics.Windows.DataPresenter.Field();
field.Label = row.ColumnHeader;
field.IsPrimary = row.PrimaryField;
field.Settings.CellMinWidth = row.ColumnWidth;
field.Settings.CellMaxWidth = row.ColumnWidth;
field.Settings.LabelMinWidth = row.ColumnWidth;
field.Settings.LabelMaxWidth = row.ColumnWidth;
//add the field to the fields collection
fieldLayout.Fields.Add(field);
How do I add a converter to the field? The converter could be any converter, but in this instance i need a boolean to yes/no string converter.
Thanks.
Hello, I assume you are able to create the converter in XAML first? If so you can assign it as follows in C#.
field.Settings.CellValuePresenterStyle = xamGrid.Resources["myStyle"] as Style;
Cheers,
Jamie