When a XamDataGrid's root table is expanded, it may yield multiple child tables. Is there a way to show multiple root tables OR is there a way to have a hidden root table with multiple child tables that are presented to an end-user as root tables?
Thanks.
Ok I figured this out. To simulate multiple roots with a DataSet, make a dummy root table with one field that is used as a key to any immediate child tables. Next, set the datasource to that dummy root table. In XAML, modify the FieldSettings of that field added to the dummy root table. The modifications should be like so:
Lastly, in the XamDataGrid's InitializeRecord event, the root record has to be detected when it's initially displayed; after which, it has to be expanded and it's expansion indicator rendered invisible:
<igDP:Field Name="ComponentType" Label="Component Type" Visibility="Hidden">
<igDP:Field.Settings>
<igDP:FieldSettings CellMinWidth="0" CellMaxWidth="0" CellWidth="0" CellMinHeight="0" CellMaxHeight="0" CellHeight="0" />
</igDP:Field.Settings>
</igDP:Field>
// Ensure the root record has an invisible expansion indicator and is automatically expanded.
{
e.Record.IsEnabled =
false;
// To prevent automation accidents.
e.Record.ExpansionIndicatorVisibility =
Visibility.Hidden;
e.Record.IsExpanded =
true;
}
That's it! Thanks.
Hi Alex,
Could I ask you to expand on the second part of the answer? I have a root data table and multiple child tables. How do I not show the root table but show the child tables in a way that from a user's point of view will look like multiple root tables?
Hello,
Regarding your first question, I believe this is not possible. You can do this, but by adding DataItems objects in the DataItems collection of the XamDataGrid, but is not available for DataTabled.
However, it is possible to do this using a root DataTable, which has parent-child relations to two other DataTables and bind the root DataTable to the DataSource of the XamDataGrid.
Hope this helps.