         else
         {
             const rowCount:int = grid.dataProvider ? grid.dataProvider.length : 0;
-            const rowGap:Number = gridDimensions.rowGap;
-            const defaultRowHeight:Number = 
-                typicalLayoutElement.getPreferredBoundsHeight();
-
-            measuredHeight = rowCount * (defaultRowHeight + rowGap);
-            
-            // One less row gap if there isn't a column header bar.
-            const columnHeaderBar:ColumnHeaderBar = getColumnHeaderBar();
-            if (!columnHeaderBar || !columnHeaderBar.visible)
-                measuredHeight -= rowGap;
+            
+            if (rowCount)
+            {
+                const rowGap:Number = gridDimensions.rowGap;
+                const defaultRowHeight:Number = 
+                    typicalLayoutElement.getPreferredBoundsHeight();
+    
+                measuredHeight = rowCount * (defaultRowHeight + rowGap);
+                
+                // One less row gap if there isn't a column header bar.
+                const columnHeaderBar:ColumnHeaderBar = getColumnHeaderBar();
+                if (!columnHeaderBar || !columnHeaderBar.visible)
+                    measuredHeight -= rowGap;
+            }
         }
                     
-        // ToDo:(cframpto)  If there is a scroller without an explicit size, 
-        // what should the measured size of the grid?
-        
-        measuredWidth = Math.min(measuredWidth, 600);
-        measuredHeight = Math.min(measuredHeight, 480);
+        // ToDo:(cframpto) how is this suppose to work if the DataGrid
+        // doesn't have an explicit size and the measuredHeight is large?
+                
+        measuredWidth = 600;
+        measuredHeight = 480;
         
         // Use Math.ceil() to make sure that if the content partially occupies
         // the last pixel, we'll count it as if the whole pixel is occupied.

        
        grid.itemRendererGroup.addElement(renderer);
        
        // Initialize cell 0,0.
        initializeItemRenderer(renderer, 0, 0, typicalItem, false);
        layoutGridElement(renderer, 0, 0, NaN, NaN);

        grid.itemRendererGroup.removeElement(renderer);
        

        {
            const columns:IList = grid.columns;
            const numColumns:int = columns ? columns.length : 0;
            
            if (numColumns)
            {
                const defaultColumnWidth:Number =
                    !isNaN(typicalLayoutElement.getLayoutBoundsWidth()) ? 
                    typicalLayoutElement.getLayoutBoundsWidth() :
                    typicalLayoutElement.getPreferredBoundsWidth();
                
                const columnGap:Number = gridDimensions.columnGap;
                
                for (var i:int = 0; i < numColumns; i++)
                {
                    var c:GridColumn = columns.getItemAt(i) as GridColumn;
                    if (c && c.visible)
                    {
                        if (!isNaN(c.width))
                            measuredWidth += c.width + columnGap;
                        else
                            measuredWidth += defaultColumnWidth + columnGap;
                    }
                }
                
                if (measuredWidth > 0)
                    measuredWidth -= columnGap;
            }
        }
        
        if (!isNaN(grid.explicitHeight))
