         if (value == oldLayout)
             return; 
 
+        if (oldLayout)
+        {
+            oldLayout.typicalLayoutElement = null;
+            oldLayout.removeEventListener("useVirtualLayoutChanged", layout_useVirtualLayoutChangedHandler);
+        }
+        // Changing the layout may implicitly change layout.useVirtualLayout
+        if (oldLayout && value && (oldLayout.useVirtualLayout != value.useVirtualLayout))
+            changeUseVirtualLayout();
         super.layout = value;    
-        if (oldLayout)
-            oldLayout.typicalLayoutElement = null;
         if (value)
         {
             // If typicalLayoutElement was specified for this DataGroup, then use

                value.typicalLayoutElement = typicalLayoutElement;
            else
                typicalLayoutElement = value.typicalLayoutElement;
        }
    } 
    
    //----------------------------------
    //  itemRenderer
    //----------------------------------

package spark.components
{
import flash.display.DisplayObject;
import flash.events.Event;
import flash.utils.Dictionary;

import mx.collections.IList;
