File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
Microsoft.Toolkit.Uwp.UI.Controls.Core/DropShadowPanel
Microsoft.Toolkit.Uwp.UI/Helpers Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 44
55using System ;
66using System . Numerics ;
7- using System . Threading . Tasks ;
87using Windows . UI ;
98using Windows . UI . Composition ;
109using Windows . UI . Xaml ;
@@ -168,7 +167,13 @@ private void UpdateShadowMask()
168167 {
169168 CompositionBrush mask = null ;
170169
171- if ( Content is Image )
170+ // We check for IAlphaMaskProvider first, to ensure that we use the custom
171+ // alpha mask even if Content happens to extend any of the other classes
172+ if ( Content is IAlphaMaskProvider maskedControl )
173+ {
174+ mask = maskedControl . GetAlphaMask ( ) ;
175+ }
176+ else if ( Content is Image )
172177 {
173178 mask = ( ( Image ) Content ) . GetAlphaMask ( ) ;
174179 }
Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+ // See the LICENSE file in the project root for more information.
4+
5+ using Windows . UI . Composition ;
6+
7+ namespace Microsoft . Toolkit . Uwp . UI
8+ {
9+ /// <summary>
10+ /// Any user control can implement this interface to provide a custom alpha mask to it's parent DropShadowPanel
11+ /// </summary>
12+ public interface IAlphaMaskProvider
13+ {
14+ /// <summary>
15+ /// This method should return the appropiate alpha mask to be used in the shadow of this control
16+ /// </summary>
17+ /// <returns>The alpha mask as a composition brush</returns>
18+ CompositionBrush GetAlphaMask ( ) ;
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments