Here is a simplified version of what i'm trying to achieve.
I have a product class with a collection of user defined fields
public class Product
{
public string ProductName { get; set; }
public string Category { get; set; }
public List<UserDefinedField> userDefinedfields;
}
public
class
UserDefinedField
{
public
string
Name {
get
;
set
; }
public
string
Value {
get
;
set
; }
}
I can bind the name and category easily in Xaml.
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding ProductName}"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Category}"
/>
I'd like to also bind the collection of user defined field to the end of the grid in code behind. I've tried this but no luck, the columns are created but no data is loaded.
foreach
(UserDefinedField udf
in
products[0].UserDefinedFields)
{
ProductGrid.Columns.Add(
new
GridViewDataColumn
{
Header = udf.Name,
DataMemberBinding =
new
Binding(udf.Value)
});
}
Thank you in advance.