Skip to content

Commit edb9b1b

Browse files
committed
Removed legacy SupportsCompositionVisualSurface.
Fixes #4364
1 parent ff03a97 commit edb9b1b

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

CommunityToolkit.WinUI.UI.Media/Shadows/AttachedCardShadow.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ public double CornerRadius
4848
set => SetValue(CornerRadiusProperty, value);
4949
}
5050

51-
/// <inheritdoc/>
52-
public override bool IsSupported => SupportsCompositionVisualSurface;
53-
5451
/// <inheritdoc/>
5552
protected internal override bool SupportsOnSizeChangedEvent => true;
5653

@@ -76,11 +73,6 @@ protected override void OnPropertyChanged(AttachedShadowElementContext context,
7673
/// <inheritdoc/>
7774
protected override CompositionBrush GetShadowMask(AttachedShadowElementContext context)
7875
{
79-
if (!SupportsCompositionVisualSurface)
80-
{
81-
return null;
82-
}
83-
8476
// Create rounded rectangle geometry and add it to a shape
8577
var geometry = context.GetResource(RoundedRectangleGeometryResourceKey) ?? context.AddResource(
8678
RoundedRectangleGeometryResourceKey,

CommunityToolkit.WinUI.UI/Shadows/AttachedDropShadow.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ public sealed class AttachedDropShadow : AttachedShadowBase
2222
{
2323
private const float MaxBlurRadius = 72;
2424

25-
/// <inheritdoc/>
26-
public override bool IsSupported => true;
27-
2825
/// <inheritdoc/>
2926
protected internal override bool SupportsOnSizeChangedEvent => true;
3027

@@ -276,7 +273,7 @@ protected override CompositionBrush GetShadowMask(AttachedShadowElementContext c
276273

277274
// If we don't have a mask and have specified rounded corners, we'll generate a simple quick mask.
278275
// This is the same code from link:AttachedCardShadow.cs:GetShadowMask
279-
if (mask == null && SupportsCompositionVisualSurface && CornerRadius > 0)
276+
if (mask == null && CornerRadius > 0)
280277
{
281278
// Create rounded rectangle geometry and add it to a shape
282279
var geometry = context.GetResource(RoundedRectangleGeometryResourceKey) ?? context.AddResource(

CommunityToolkit.WinUI.UI/Shadows/AttachedShadowBase.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ namespace CommunityToolkit.WinUI.UI
2020
/// </summary>
2121
public abstract class AttachedShadowBase : DependencyObject, IAttachedShadow
2222
{
23-
/// <summary>
24-
/// Gets a value indicating whether or not Composition's VisualSurface is supported.
25-
/// </summary>
26-
protected static readonly bool SupportsCompositionVisualSurface = ApiInformation.IsTypePresent(typeof(CompositionVisualSurface).FullName);
27-
2823
/// <summary>
2924
/// The <see cref="DependencyProperty"/> for <see cref="BlurRadius"/>.
3025
/// </summary>
@@ -53,11 +48,6 @@ public abstract class AttachedShadowBase : DependencyObject, IAttachedShadow
5348
public static readonly DependencyProperty OpacityProperty =
5449
DependencyProperty.Register(nameof(Opacity), typeof(double), typeof(AttachedShadowBase), new PropertyMetadata(1d, OnDependencyPropertyChanged));
5550

56-
/// <summary>
57-
/// Gets a value indicating whether or not this <see cref="AttachedShadowBase"/> implementation is supported on the current platform.
58-
/// </summary>
59-
public abstract bool IsSupported { get; }
60-
6151
/// <summary>
6252
/// Gets or sets the collection of <see cref="AttachedShadowElementContext"/> for each element this <see cref="AttachedShadowBase"/> is connected to.
6353
/// </summary>
@@ -106,11 +96,6 @@ protected static void OnDependencyPropertyChanged(object sender, DependencyPrope
10696

10797
internal void ConnectElement(FrameworkElement element)
10898
{
109-
if (!IsSupported)
110-
{
111-
return;
112-
}
113-
11499
ShadowElementContextTable = ShadowElementContextTable ?? new ConditionalWeakTable<FrameworkElement, AttachedShadowElementContext>();
115100
if (ShadowElementContextTable.TryGetValue(element, out var context))
116101
{

0 commit comments

Comments
 (0)