Hi,
I'm having trouble with the XamDataGrid component when I try to bind multiple columns to the same property of an object.
Let's assume we have this class :
public class Person{
public string Name{get;set;}
}
And a simple XamDataGrid like this :
<igWPF:XamDataGrid>
<igWPF:XamDataGrid.FieldLayoutSettings> <igWPF:FieldLayoutSettings AutoGenerateFields="False" /> </igWPF:XamDataGrid.FieldLayoutSettings>
<igWPF:XamDataGrid.FieldLayouts> <igWPF:FieldLayout> <igWPF:Field Name="Name" Label="Name" /> <igWPF:Field Name="Name" Label="Name" /> </igWPF:FieldLayout> </igWPF:XamDataGrid.FieldLayouts>
</igWPF:XamDataGrid>
When I execute this I have a System.NotSupportedException thrown, with the following message :
Field named Name was not found in data source: Test.Person
Do you have any idea on how I could use twice the same column in the same XamDataGrid ? (Of course I'm not only showing twice the same columns for fun, I need it because one of them will use a converter).
Thank you for your help.
ps : Sorry for my English, I'm French.
Hello Mickael,
I am just checking if you have any further questions on this matter. Please do not hesitate to let me know if you do.
Sincerely,
Radko Kolev
Infragistics Inc.
www.infragistics.com/support
In versions older than 14.2 you can use the UnboundField like this:
<igDP:UnboundField Binding="{Binding Path=Name}" Label="Second Time Name" />
If you require any further assistance, please do not hesitate to ask.
Hello,
Thank you for you help, unfortunately we are currently not using the 2015.1 version of your product but the 2014.1.
I don't find the TextField class in the 2014.1 version of the DataPresenter, is this a new feature which arrived with the 2015.1 version ?
Is there a way to achieve the same result using the 2014.1 version ?
I found UnboundField which seems to do the trick.
Thank for your post. You may define additional fields bound to the same data object's property by setting their BindingType property to "UseAlternateBinding" and specify the required field in their AlternateBinding property.
Here is an example:
<igDP:TextField BindingType="UseAlternateBinding" AlternateBinding="{Binding Path=Name}" Label="Second Time Name" />
You can also read more information on this matter at the following locations:
http://help.infragistics.com/doc/WPF?page=xamDataPresenter_Binding_Field_FieldLayout_to_MVVM.html
http://help.infragistics.com/doc/WPF?page=xamDataPresenter_Add_Unbound_Fields_to_a_DataPresenter_Control.html
I am also attaching a sample application showing three field definitions to one data object's property.
Please do not hesitate to let me know if you have any further questions on this matter.
Infragistics