-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Describe the problem this feature would solve
Currently it is impossible to use DropShadowPanel to project masked shadows for custom usercontrols, since GetAlphaMask is only implemented in a handful of framework controls (Image, Shape, TextBlock) the DropShadowPanel only attempts to get an alpha mask if the Content is an instance of those types.
This is especially painful if you need to wrap all your Images/Shapes/Text in some other control, since ideally you would just "pass through" the alpha mask provided by the native control.
Describe the solution
Solution A:
To allow developers to leverage DropShadowPanel for their own controls, we could define an interface e.g.
interface IAlphaMask
{
CompositionBrush GetAlphaMask();
}
that they can implement to specify which alpha mask they want to be used, and DropShadowPanel would recognize it and use the right mask.
Solution B:
DropShadowPanel could have a SetContentAlphaMask method that allows the developer to provide alpha masks. This alpha mask would override the one that is provided by the content control, if it has one. This would be very useful to create non-rectangular shadows (e.g. with round corners) for existing framework elements (e.g. grid, inkcanvas...).
I think both solutions would be worth having in the control, I have been in many situations where I would have used them if they were available.
I'm happy to contribute this if it sounds valuable :)