-
Notifications
You must be signed in to change notification settings - Fork 802
Closed
Labels
needs-triageIssue needs to be triaged by the area ownersIssue needs to be triaged by the area owners
Description
Describe the bug
I cant create a DropShadow behind a control. The shadow is always in front of it!
void ApplyDropShadow(FrameworkElement const& element) {
// Get the Compositor and Visual for the element
auto visual = ElementCompositionPreview::GetElementVisual(element);
auto compositor = visual.Compositor();
// Create a DropShadow
DropShadow dropShadow = compositor.CreateDropShadow();
dropShadow.Color(winrt::Windows::UI::ColorHelper::FromArgb(255, 0, 255, 255));
dropShadow.BlurRadius(30.0f);
dropShadow.Opacity(0.8f);
dropShadow.Offset({ -5.0f, -5.0f, 0.0f });
// Create a SpriteVisual and set the shadow
SpriteVisual shadowVisual = compositor.CreateSpriteVisual();
shadowVisual.Shadow(dropShadow);
// Set the size of the shadow to match the element
shadowVisual.Size({ element.ActualSize().x + 10, element.ActualSize().y + 10 });
// Place the container visual behind the XAML element
ElementCompositionPreview::SetElementChildVisual(element, shadowVisual);
}
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs-triageIssue needs to be triaged by the area ownersIssue needs to be triaged by the area owners