In the recent update to 14.2, there are now some compiler warnings about UnboundField being deprecated. It says to 'Use Field with BindingType set to Unbound or UseAlternateBinding instead".
I have tried both without success.
My original code had bindings set up like this:
Field field = new UnboundField { BindingMode = BindingMode.TwoWay, BindingPath = new PropertyPath(MyPropertyName) };
What is the new syntax for how my old code works?
From what I see in the compiler warnings, this should be the equivalent:
Field field = new Field { BindingType = BindingType.UseAlternateBinding, AlternateBinding = new Binding(MyPropertyName) };
But it does not function properly.
Thanks,
Jon
Hi Jon,
Let me first recommend that you review this documentation.
http://help.infragistics.com/Help/Doc/WPF/2014.2/CLR4.0/html/xamDataPresenter_Add_Unbound_Fields_to_a_DataPresenter_Control.html
If you want to create the equivalent of an unbound field you can set a field's BindingType to Unbound.
Field fldUnbound = new Field
{
Name = "FLD_Name",
Label = "Unbound FLD_Name Field",
BindingType = BindingType.Unbound
};
You would now need to provide the value for FLD_Name in the InitializeRecord
Perhaps assigning a value based on other fields, as in the example in the documentation.
if (e.Record is DataRecord)
var dr = (DataRecord)e.Record;
dr.Cells["FLD_Name "].Value = "This field is unbound";
}
Or if you want to use the alternate binding method (ID is a property in my collection object)
This binds the field to the value in ID.
Field field = new Field {
Label="UseAlternateBinding ID",
BindingType = BindingType.UseAlternateBinding,
AlternateBinding = new Binding("ID")
The default BindingType is UseNameBinding, which, as you would expect, is binding to the Named property value in your data.
Let me know if you have any questions.
Hello Jon,
Do you have any other questions on this matter?
Sincerely,Valerie Developer Support Supervisor - XAMLInfragisticswww.infragistics.com/support