@@ -226,7 +226,7 @@ protected void DrawImage(DrawingContext drawingContext, ImageSource image, Rect
226226 DrawingContext tempDrawingContext = visual . RenderOpen ( ) ;
227227 tempDrawingContext . DrawImage ( image , rectangle ) ;
228228 tempDrawingContext . Close ( ) ;
229- RenderVisual ( drawingContext , visual , rectangle ) ;
229+ RenderVisual ( drawingContext , visual , ! visual . ContentBounds . IsEmpty ? visual . ContentBounds : rectangle ) ;
230230 }
231231
232232 }
@@ -253,7 +253,7 @@ protected void DrawGeometry(DrawingContext drawingContext, Brush brush, Pen pen,
253253 DrawingContext tempDrawingContext = visual . RenderOpen ( ) ;
254254 tempDrawingContext . DrawGeometry ( brush , pen , path ) ;
255255 tempDrawingContext . Close ( ) ;
256- RenderVisual ( drawingContext , visual , rectangle ) ;
256+ RenderVisual ( drawingContext , visual , ! visual . ContentBounds . IsEmpty ? visual . ContentBounds : rectangle ) ;
257257 }
258258 }
259259 /// <summary>
@@ -278,7 +278,7 @@ protected void DrawRectangle(DrawingContext drawingContext, Brush brush, Pen pen
278278 DrawingContext tempDrawingContext = visual . RenderOpen ( ) ;
279279 tempDrawingContext . DrawRectangle ( brush , pen , rectangle ) ;
280280 tempDrawingContext . Close ( ) ;
281- RenderVisual ( drawingContext , visual , rectangle ) ;
281+ RenderVisual ( drawingContext , visual , ! visual . ContentBounds . IsEmpty ? visual . ContentBounds : rectangle ) ;
282282 }
283283 }
284284 /// <summary>
@@ -303,7 +303,7 @@ protected void DrawRoundedRectangle(DrawingContext drawingContext, Brush brush,
303303 DrawingContext tempDrawingContext = visual . RenderOpen ( ) ;
304304 tempDrawingContext . DrawRoundedRectangle ( brush , pen , rectangle , radiusX , radiusY ) ;
305305 tempDrawingContext . Close ( ) ;
306- RenderVisual ( drawingContext , visual , rectangle ) ;
306+ RenderVisual ( drawingContext , visual , ! visual . ContentBounds . IsEmpty ? visual . ContentBounds : rectangle ) ;
307307 }
308308 }
309309 /// <summary>
@@ -331,7 +331,7 @@ protected void DrawText(DrawingContext drawingContext, ITextControl textVisual,
331331 DrawingContext tempDrawingContext = visual . RenderOpen ( ) ;
332332 textVisual . TextFormat . RenderText ( tempDrawingContext , brush , text , rectangle ) ;
333333 tempDrawingContext . Close ( ) ;
334- RenderVisual ( drawingContext , visual , rectangle ) ;
334+ RenderVisual ( drawingContext , visual , ! visual . ContentBounds . IsEmpty ? visual . ContentBounds : rectangle ) ;
335335 }
336336 }
337337#endregion Draw Proxies
0 commit comments