diff --git a/Microsoft.Toolkit.Uwp.UI/Shadows/AttachedDropShadow.cs b/Microsoft.Toolkit.Uwp.UI/Shadows/AttachedDropShadow.cs index f6fe707a7cf..cea31d06191 100644 --- a/Microsoft.Toolkit.Uwp.UI/Shadows/AttachedDropShadow.cs +++ b/Microsoft.Toolkit.Uwp.UI/Shadows/AttachedDropShadow.cs @@ -290,7 +290,11 @@ protected override CompositionBrush GetShadowMask(AttachedShadowElementContext c // Create a ShapeVisual so that our geometry can be rendered to a visual var shapeVisual = context.GetResource(ShapeVisualResourceKey) ?? context.AddResource(ShapeVisualResourceKey, context.Compositor.CreateShapeVisual()); - shapeVisual.Shapes.Add(shape); + + if (!shapeVisual.Shapes.Contains(shape)) + { + shapeVisual.Shapes.Add(shape); + } // Create a CompositionVisualSurface, which renders our ShapeVisual to a texture var visualSurface = context.GetResource(VisualSurfaceResourceKey) ?? @@ -344,6 +348,7 @@ protected internal override void OnSizeChanged(AttachedShadowElementContext cont context.SpriteVisual.Offset = context.Element.CoordinatesFrom(CastTo).ToVector3(); UpdateShadowClip(context); + UpdateShadowMask(context); base.OnSizeChanged(context, newSize, previousSize); }