-
Notifications
You must be signed in to change notification settings - Fork 703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create a DropShadow behind a control #10295
Comments
I cannot test in C++, but it is the same code as in C#; a way is to render the control with RenderTargetBitmap (similar to in this test #10062), then add the shadow (and Mask depending on the control (GetAlphaMask)) I also found other methods with another control, like at https://github.com/microsoft/uwp-experiences/blob/master/apps/News/News/Helpers/Composition/CompositionShadow.xaml.cs |
Yeah, how to get the mask for each control? The most doesn't have it (Can mask images, text, and shapes do) and if I understand it right, the https://github.com/CommunityToolkit/WindowsCommunityToolkit/blob/main/Microsoft.Toolkit.Uwp.UI.Controls.Core/DropShadowPanel/DropShadowPanel.xaml |
Without mask, the shadow will be rectangular. |
Can ThemeShadow be of help? https://medium.com/@Niels9001/elevate-your-ui-with-themeshadow-703c513fd96a |
@tpoint75 Have you tried using a negative z-index for the shadow offset? |
Ok, as I figured out: The main problem is that: "Receivers cannot be an ancestor of the caster in the visual tree." You always need something that receives the shadow and this must be a sibling of the element and be above it in the XAML tree. ThemeShadow shadow; But this limitation is a no go, because I can't build that stuff around each element. So the only way could be to get the alpha mask for every element. (How?) // Create a SpriteVisual and set the shadow Or to create this dynamically with visuals. I tried this with visual containers and appending childs, but on the one hand the shadow is visible on the other the element was gone.. |
Crazy, this 3 lines are working
|
Describe the bug
I cant create a DropShadow behind a control. The shadow is always in front of it!
Steps to reproduce the bug
execute code
Expected behavior
No response
Screenshots
No response
NuGet package version
None
Packaging type
No response
Windows version
No response
IDE
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: