Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Fields binding
posted

Hi guys,

have a question regarding Field's binding.

I've got a model similar to this one:

public class Person

{
public string Id { get; set; }

public string Name { get; set; }

public List<Orders> Orders { get; set; }

}

public class Order
{

public string Id { get; set; }

public string Name { get; set; }

public class ViewModel

{

public ObservableCollection<Person> { get; set; }

}

I''m binding List<Person> to XamTreeGrid and displaying data using XAML like:

<igDP:XamTreeGrid.FieldLayouts>
<igDP:FieldLayout Key="Person" IsDefault="True">
<igDP:Field Name="Orders" Label="Orders:" />
<igDP:TextField Name="Id" Label="Id" />
<igDP:TextField Name="Name" Label="Name" />
</igDP:FieldLayout>
<igDP:FieldLayout Key="Order" IsDefault="False">
<igDP:TextField Name="id" Label="Id" />
<igDP:TextField Name="Name" Label="Name" />
</igDP:FieldLayout>
</igDP:XamTreeGrid.FieldLayouts>

All looks good.

The problem comes when I need to introduce one more layer (my architecture needs that) and the code looks like:

public class Wrapper<T>

{

public T Data { get; set; }

}

public class ViewModel

{

public ObservableCollection<Wrapper<Person>> { get; set; }

}

So the only additional step in accessing data is "Data" property e.g. "Data.Name" instead of "Name" previously. At this point Fields stop working as they cannot find the nested property?
what's the recommended approach in this case? I know I could use AlternativeBinding in order to get the data, but I like the default behavior for nested elements - child row for Orders.
Cheers,
Dariusz 
Parents Reply Children
No Data