I've started exploring the Data and UI virtualization features in WPF recently and stumbled upon something strange.
I created a DataGrid's with Virtualizing enabled and filled it with a list with 1,000,000 items. This works great and amazingly fast. 
<Grid>
    <DataGrid x:Name="employees" VirtualizingPanel.IsVirtualizing="True" 
                                 VirtualizingPanel.IsContainerVirtualizable="True"
                                 VirtualizingPanel.VirtualizationMode="Recycling"/>
</Grid>
However, when I nested it under a StackPanel it loads for over a minute until I get OutOfMemoryException. I've set the same VirtualizingPanel properties on the StackPanel as well but it doesn't help. 
Is this behaviour intentional or am I missing something basic here? And how can I manage to support data virtualization in nested controls?
 
     
    