Hi,
I have a hierarchical set of datas like this :
public class RadiosGenre{ public List<Radio> Radios;} and I would like to put them in the xamDataGrid... and if possibe with "lazy loading"Is it possible and how ?
I have try with the following code but it do not work :
<igDP:XamDataGrid x:Name="xdgGenres"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:Field Name="Title" Label="Title"/> <igDP:Field Name="Radios"/> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
Thanks a lot,
Also, is it possible to :
- Have only one header (and not a header for each level) ?- Have the last column to use the full width ... to force last column use the maximum of space ?
Thanks
VO01
thanks a lot, it worked..
Regards
manand
If I bind to a DataView with relationships and leave the AutoGenerateFields setting to True, I get multiple levels as expected. If, however, I turn that setting off and define two FieldLayout blocks, as shown above, only the first block is shown. I get no "+" sign to drill down.
Am I missing something?
I'm sorry... I still can't get this silly thing working. I really want to fix it the right way - by predefining my field layouts in xaml.
>>Are you including a Field definition in the parent FieldLayout for the IEnumerable Field that represents the child data?
I'm wondering if I misunderstood what you meant by that. I thought you meant to include the primary key in the first group, so that the foreign key in the second group could relate to it. But now, I'm not so sure that's what you meant. I don't know what I could include in the first layout group that's ienumerable, since I'm simply referencing columns in the DataView.
Is the follownig fictitious example correct xaml, assuming a DataView on table "customers", with relationships from orders.customer_id -> customers.customer_id and order_items.order_id -> orders.order_id? Should this generate a 3-tiered grid, similar to what I'd get if I let it auto generate the field layouts?
<igDP:XamDataGrid.FieldLayouts>
<!-- From customer Table --> <igDP:FieldLayout>
<igDP:FieldLayout.Fields> <igDP:Field Name="customer_id" /> <igDP:Field Name="customer_name" /> </igDP:FieldLayout.Fields>
</igDP:FieldLayout>
<!-- From order Table --> <igDP:FieldLayout>
<igDP:FieldLayout.Fields> <igDP:Field Name="order_id" /> <igDP:Field Name="order_date" /> </igDP:FieldLayout.Fields>
<!-- From order_items Table --> <igDP:FieldLayout>
<igDP:FieldLayout.Fields> <igDP:Field Name="line_id" /> <igDP:Field Name="item_number" /> <igDP:Field Name="item_description" /> <igDP:Field Name="item_price" /> </igDP:FieldLayout.Fields>
</igDP:XamDataGrid.FieldLayouts>
I *finally* got this working! That bit about IEnumerable got me thinking, but I still couldn't find a single mention, never mind example in the docs or forums on how to do this with multiple tables. The docs mention that if the property is enumerable, it will be expandable, but it doesn't say how to make it enumerable when binding directly to a table. I resolved the problem by "reverse engineering" the auto generation behvaior.
Here's what I did:
1. Enabled auto generation of field layouts.
2. Sat on the AssigningFieldLayoutToItem event when I expanded the parent row to see the child row.
3. I noticed that e.FieldLayout.Key.ToString() was the name of my child Table. Interesting, so it created a FieldLayout object for the parent table and one for the child table.
4. Shift+F9 for the evaluation window. Browsed into the Grid instance, finding the FieldLayouts structure. There were 2, as expected. I drilled down into the Fields and found the very last field to be the name of my relationship. Ah ha!
5. I simply added a final Field definition in the xaml for the relationship:
<igDP:Field Name="parent-to-child-relationship-name" />
BAM!
Thanks for taking the time to post your findings. Exactly what I was after and you saved me having to go through the steps, or similar, that you went through.
Cheers
Hello,
Were you able to get this working ??
I have the same issue.
hello ,
I tried your way
I got Two FieldLayout but there is no field for relation
that's because the DataSource that i use is Collection of object not DataTable
so how can i control the field that i want to display in the secodn tier
and could you tell me if i can get the xaml code that was generated when i set the AutoGenerateField to true