I am using the latest WPF Toolkit but am running into a height issue when I have a large record set bound into a DataGrid inside an AccordionItem item. The height of the Accordion itself scales nicely but the DataGrid inside the accordion control doesn’t get get a ScrollBar or get constrained in any way so the records are hidden.
I know that I am most probably missing something very simple (like a binding from the DataGrid‘s height property to the Accordion but that seems messy)
here is a cut down version of the code (and yes, this has the same problem if you bind in a big recordset)
<UserControl>
<layouttoolkit:Accordion x:Name="ReportSelector" HorizontalAlignment="Stretch">
<layouttoolkit:AccordionItem Header="grid 1">
<dg:DataGrid
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
SelectionMode="Single">
...
</dg:DataGrid.Columns>
</dg:DataGrid>
</layouttoolkit:AccordionItem>
<layouttoolkit:AccordionItem Header="grid 2">
<dg:DataGrid
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
SelectionMode="Single">
...
</dg:DataGrid.Columns>
</dg:DataGrid>
</layouttoolkit:AccordionItem>
<layouttoolkit:AccordionItem Header="grid 3">
<dg:DataGrid
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
SelectionMode="Single">
...
</dg:DataGrid.Columns>
</dg:DataGrid>
</layouttoolkit:AccordionItem>
</layouttoolkit:Accordion>
</UserControl>
Looks like my initial idea was right – the only way I have been able to solve this one is to bind the
MaxHeightof theDataGridto theActualHeightof the AccordionItemAdding the following property to each
DataGriddid the trick