Skip to content

Commit 8e49fc4

Browse files
Merge branch 'main' into user/arcadiog/shorterExpressionStrings
2 parents 50008c0 + d863f11 commit 8e49fc4

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.Core/DropShadowPanel/DropShadowPanel.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
using System;
66
using System.Numerics;
7-
using System.Threading.Tasks;
87
using Windows.UI;
98
using Windows.UI.Composition;
109
using 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
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
}

ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The Windows Community Toolkit is a collection of helper functions, custom contro
55
| Target | Branch | Status | Recommended package version |
66
| ------ | ------ | ------ | ------ |
77
| Production | rel/7.0.2 | [![Build Status](https://dev.azure.com/dotnet/CommunityToolkit/_apis/build/status/Toolkit-CI?branchName=rel/7.0.2)](https://dev.azure.com/dotnet/CommunityToolkit/_build/latest?definitionId=10&branchName=rel/7.0.2) | [![NuGet](https://img.shields.io/nuget/v/Microsoft.Toolkit.Uwp.svg)](https://www.nuget.org/profiles/Microsoft.Toolkit) |
8-
| Pre-release beta testing | main | [![Build Status](https://dev.azure.com/dotnet/CommunityToolkit/_apis/build/status/Toolkit-CI?branchName=main)](https://dev.azure.com/dotnet/CommunityToolkit/_build/latest?definitionId=10) | [![DevOps](https://vsrm.dev.azure.com/dotnet/_apis/public/Release/badge/696bc9fd-f160-4e97-a1bd-7cbbb3b58f66/1/1)](https://dev.azure.com/dotnet/CommunityToolkit/_packaging?_a=feed&feed=WindowsCommunityToolkit-MainLatest) |
8+
| Pre-release beta testing | main | [![Build Status](https://dev.azure.com/dotnet/CommunityToolkit/_apis/build/status/Toolkit-CI?branchName=main)](https://dev.azure.com/dotnet/CommunityToolkit/_build/latest?definitionId=10) | [![DevOps](https://vsrm.dev.azure.com/dotnet/_apis/public/Release/badge/696bc9fd-f160-4e97-a1bd-7cbbb3b58f66/1/1)](https://dev.azure.com/dotnet/CommunityToolkit/_packaging?_a=feed&feed=CommunityToolkit-MainLatest) |
99

1010
## Getting Started :raised_hands:
1111
Please read the [Getting Started with the Windows Community Toolkit](https://docs.microsoft.com/windows/communitytoolkit/getting-started) page for more detailed information about using the toolkit.

0 commit comments

Comments
 (0)