Skip to content

Commit f6ec0f2

Browse files
committed
DropShadowPanel Content wireup size changed
Wire up DropShadowPanel Content's size change to ensure that shadow is updated correctly. Address #1111 and #1299
1 parent 894a3d7 commit f6ec0f2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ public DropShadowPanel()
5050

5151
_dropShadow = compositor.CreateDropShadow();
5252
_shadowVisual.Shadow = _dropShadow;
53-
54-
SizeChanged += OnSizeChanged;
5553
}
5654
}
5755

@@ -72,6 +70,13 @@ protected override void OnApplyTemplate()
7270
ElementCompositionPreview.SetElementChildVisual(_border, _shadowVisual);
7371
}
7472

73+
var content = this.Content as FrameworkElement;
74+
75+
if (content != null)
76+
{
77+
content.SizeChanged += OnSizeChanged;
78+
}
79+
7580
ConfigureShadowVisualForCastingElement();
7681

7782
base.OnApplyTemplate();

0 commit comments

Comments
 (0)