I'm using entity framework classes as my datasource
The class is OrderDetail which have these properties:ID (int) Item(Class Item)Quantity (int)Subtotal (decimal)
Class Item has these propertiesID (int)Name (string)
So i set the xamDataGrid.Datasource = List(of OrderDetail)
I want to show the columns: Item.Name, Quantity, and Subtotal
So I specified 3 fields. I'm having problem setting the Field Name for Item.Name. "Item.Name" doesn't work, if I use that I get a blank grid.
Is this at all possible? I can easily bind "Item.Name" within a ListBox DataTemplate, how do I this with xamDataGrid.
Thank you
Hi,
A Field object cannot bind to nested/complex properties. In order to bind to nested/complex properties, you need to add an UnboundField object to your Fields collection. For an example, you can click on a link below:
An example in XAML
An example in C#/VB.NET
Hope that helps. :)
hi,
i have the same question, but none of the links being posted in this thread are working.
i just get the yellow .net exception with: An error occurred loading a configuration file: Directory 'E:\websites\help.infragistics.com\Help\netadvantage\wpf\2008.1' does not exist. Failed to start monitoring file changes.
I found some updated links:
http://help.infragistics.com/NetAdvantage/WPF/2011.1/CLR4.0/?page=xamDataPresenter_Displaying_a_Complex_Property.html
http://help.infragistics.com/NetAdvantage/WPF/2011.1/CLR4.0/?page=xamDataPresenter_Displaying_a_Complex_Property_XAML.html
Hello Nikhil,
Thank you for the attached code snippet.
I have reviewed it and the exception you are getting is caused from the line where you set the AlternateBinding property. Instead of using convention like in name binding you can include the Binding word, for example:
AlternateBinding="Security.Item" should be AlternateBinding="{Binding Security.Item}"
Addition details about AlternateBinding and BindingMode are available here:
http://help.infragistics.com/Doc/WPF/2016.1/CLR4.0/?page=xamDataPresenter_Add_Unbound_Fields_to_a_DataPresenter_Control.html
Please let me know if you require any further assistance regarding in this matter.
Sincerely, ZhivkoEntry Level Software Developer
Hi Team,
The 2016.1 link is
http://help.infragistics.com/Doc/WPF/2016.1/CLR4.0/?page=xamDataPresenter_Displaying_a_Complex_Property_XAML.html
Now that Unbound Field is Obsolete, I tried using Field like this<dataPresenter:Field Name="Identifier" BindingType="Unbound" BindingType="UseAlternateBinding" Label="ISIN" AlternateBinding="Security.Item"> <dataPresenter:Field.Settings> <dataPresenter:FieldSettings AllowEdit="False" /> </dataPresenter:Field.Settings></dataPresenter:Field>
but it gives error irrespective of BindingType changed to Unbound or UseAlternateBinding.
'Set property 'Infragistics.Windows.DataPresenter.Field.AlternateBinding' threw an exception.' Line number '336' and line position '107'.
Also, in XAML AlternateBinding gives warning 'The TypeConverter for "BindingBase" does not support converting from a string.'
What is the solution?