WindowsCommunityToolkit
WindowsCommunityToolkit copied to clipboard
Ryken100/attached card shadow composition mask brush resize fix
Fixes #4587
This PR fixes an issue where when AttachedCardShadow.InnerContentClipType
is set to CompositionMaskBrush
, the shadow doesn't properly resize when the element it's attached to changes size. It also fixes an issue where if InnerContentClipType
is set to CompositionMaskBrush
then back to CompositionGeometricClip
, resizing gets broken in the CompositionGeometricClip
mode as well.
PR Type
What kind of change does this PR introduce?
Bugfix
What is the current behavior?
When AttachedCardShadow.InnerContentClipType == CompositionMaskBrush
, the sizes of the masked SpriteVisual
, and the SpriteVisual
that owns the shadow were not updated when the attached FrameworkElement
changes size. Additionally, AttachedShadowElementContext.SpriteVisual.Size
and RelativeSizeAdjustment
values were not reset to default when InnerContentClipType
changed from CompositionMaskBrush
to CompositionGeometricClip
.
What is the new behavior?
When AttachedCardShadow.InnerContentClipType == CompositionMaskBrush
, the sizes of the masked SpriteVisual
, and the SpriteVisual
are now updated when the attached FrameworkElement
changes size. Additionally, AttachedShadowElementContext.SpriteVisual.Size
and RelativeSizeAdjustment
are reset to default when AttachedCardShadow.InnerContentClipType == CompositionGeometricClip
, preventing potential resize issues.
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
- [x] Based off latest main branch of toolkit
- [x] Tested code with current supported SDKs
- [x] Contains NO breaking changes
Other information
Thanks Ryken100 for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌