Skip to content

Commit 59cd9fe

Browse files
committed
Avoid adding shapes repeatedly
1 parent d7ba0fa commit 59cd9fe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Microsoft.Toolkit.Uwp.UI/Shadows/AttachedDropShadow.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,11 @@ protected override CompositionBrush GetShadowMask(AttachedShadowElementContext c
290290
// Create a ShapeVisual so that our geometry can be rendered to a visual
291291
var shapeVisual = context.GetResource(ShapeVisualResourceKey) ??
292292
context.AddResource(ShapeVisualResourceKey, context.Compositor.CreateShapeVisual());
293-
shapeVisual.Shapes.Add(shape);
293+
294+
if (!shapeVisual.Shapes.Contains(shape))
295+
{
296+
shapeVisual.Shapes.Add(shape);
297+
}
294298

295299
// Create a CompositionVisualSurface, which renders our ShapeVisual to a texture
296300
var visualSurface = context.GetResource(VisualSurfaceResourceKey) ??

0 commit comments

Comments
 (0)