WindowsCommunityToolkit
WindowsCommunityToolkit copied to clipboard
AttachedCardShadow with InnerContentClipMode == CompositionMaskBrush isn't correctly resized when the UIElement it's attached to changes size
Describe the bug
When AttachedCardShadow.InnerContentClipMode
is set to CompositionMaskBrush
, and the size of the element it's attached to changes, the shadow isn't properly resized to match.
Regression
No response
Reproducible in sample app?
- [ ] This bug can be reproduced in the sample app.
Steps to reproduce
1. Create a new blank UWP app.
2. Add a `Rectangle` to `MainPage.xaml`.
3. Attach an `AttachedCardShadow` to the `Rectangle` and set `InnerContentClipMode` to `CompositionMaskBrush`
4. Implement some way to change the size of the `Rectangle` (e.g. have it change size on click)
5. Observe that when the size of the `Rectangle` changes, some of the elements that make up the shadow do not change size to match, leading to a glitched appearance.
Expected behavior
All elements of the shadow should change size to match the UIElement
it's attached to, without a glitched appearance.
Screenshots
Before the Rectangle is resized
After the Rectangle is resized
Windows Build Number
- [ ] Windows 10 1809 (Build 17763)
- [ ] Windows 10 1903 (Build 18362)
- [ ] Windows 10 1909 (Build 18363)
- [ ] Windows 10 2004 (Build 19041)
- [ ] Windows 10 20H2 (Build 19042)
- [ ] Windows 10 21H1 (Build 19043)
- [X] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)
Other Windows Build number
No response
App minimum and target SDK version
- [ ] Windows 10, version 1809 (Build 17763)
- [X] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [ ] Windows 10, version 2004 (Build 19041)
- [ ] Other (specify)
Other SDK version
No response
Visual Studio Version
2022
Visual Studio Build Number
No response
Device form factor
Desktop
Nuget packages
No response
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item.
Hello Ryken100, thank you for opening an issue with us!
I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌
This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.
Was able to reproduce in the sample app with some tweaks to the implicit animation sample
SampleController.Current.RegisterNewCommand("Size Element", (sender, args) =>
{
if (_element is FrameworkElement fwe)
{
fwe.Width = _random.Next(200) + 100;
fwe.Height = _random.Next(200) + 100;
}
});
And using a Rectangle
over a Border
without the Canvas
see #4739