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
415
XamDataGrid to show a property of a property?
posted

I have a data binding between a XamDataGrid and a collection of somewhat complex objects. Lets call the object a MobilePhone. The MobilePhone object has another object called Processor which itself has public properties that I want to show up in the XamDataGrid.

This doesn't seem to work automatically so I thought I would add some field layouts to the XamDataGrid that might be capable of displaying those properties on the Processor. For example I added:

<igWPF:XamDataGrid.FieldLayouts>
<igWPF:FieldLayout>
<igWPF:FieldLayout.Fields>
<igWPF:Field Name="BRAND" Label="Brand" />
<igWPF:Field Name="PRODUCT" Label="Model" />
<igWPF:Field Name="Processor.PRODUCT" Label="CPU Product" />
<igWPF:Field Name="Processor.Speed" Label="CPU Speed" />
</igWPF:FieldLayout.Fields>
</igWPF:FieldLayout>
</igWPF:XamDataGrid.FieldLayouts>
However, I can't get this to work and I can't find a working sample that shows properties of properties of bound data.
I want to have the following columns:
BRAND   PRODUCT  CPU Product  CPU Speed
As it is now, I get the first two columns and then the third column that shows the classname of the Processor object.

  • 415
    Verified Answer
    Offline posted

    I found the answer I needed.

    Simply use an Unbound data field. I was able to just add the following:

    <igWPF:UnboundField Name="Processor.Speed" BindingPath="Processor.Speed" Label="CPU Speed" />