Skip to content

Commit f48df97

Browse files
Clean-up some documentation and info about min version to sample app
1 parent ed42e41 commit f48df97

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@
192192
"CodeUrl": "https://github.com/CommunityToolkit/WindowsCommunityToolkit/tree/main/Microsoft.Toolkit.Uwp.UI.Media/Shadows",
193193
"XamlCodeFile": "/SamplePages/Shadows/AttachedShadowWin2DXaml.bind",
194194
"Icon": "/SamplePages/Shadows/DropShadowPanel.png",
195-
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/DropShadowPanel.md"
195+
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/DropShadowPanel.md",
196+
"BadgeUpdateVersionRequired": "May 2019 update required",
197+
"ApiCheck": "Windows.UI.Composition.CompositionVisualSurface"
196198
},
197199
{
198200
"Name": "DropShadowPanel",

Microsoft.Toolkit.Uwp.UI.Media/Shadows/AttachedCardShadow.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public class AttachedCardShadow : AttachedShadowBase
1717
private const float MaxBlurRadius = 72;
1818
private static readonly TypedResourceKey<CompositionGeometricClip> ClipResourceKey = "Clip";
1919
private static readonly bool SupportsCompositionVisualSurface;
20-
private static readonly bool SupportsCompositionGeometricClip;
2120

2221
private static readonly TypedResourceKey<CompositionPathGeometry> PathGeometryResourceKey = "PathGeometry";
2322
private static readonly TypedResourceKey<CompositionRoundedRectangleGeometry> RoundedRectangleGeometryResourceKey = "RoundedGeometry";
@@ -34,12 +33,11 @@ public class AttachedCardShadow : AttachedShadowBase
3433
nameof(CornerRadius),
3534
typeof(double),
3635
typeof(AttachedCardShadow),
37-
new PropertyMetadata(8d, OnDependencyPropertyChanged));
36+
new PropertyMetadata(4d, OnDependencyPropertyChanged)); // Default WinUI ControlCornerRadius is 4
3837

3938
static AttachedCardShadow()
4039
{
41-
SupportsCompositionGeometricClip = ApiInformation.IsTypePresent(typeof(CompositionGeometricClip).FullName);
42-
SupportsCompositionVisualSurface = ApiInformation.IsTypePresent(typeof(CompositionVisualSurface).FullName); ;
40+
SupportsCompositionVisualSurface = ApiInformation.IsTypePresent(typeof(CompositionVisualSurface).FullName); // Note: This is 1903 (18362) min
4341
}
4442

4543
/// <summary>
@@ -51,15 +49,20 @@ public double CornerRadius
5149
set => SetValue(CornerRadiusProperty, value);
5250
}
5351

52+
/// <inheritdoc/>
5453
public override bool IsSupported => SupportsCompositionVisualSurface;
54+
55+
/// <inheritdoc/>
5556
protected override bool SupportsOnSizeChangedEvent => true;
5657

58+
/// <inheritdoc/>
5759
protected override void OnElementContextUninitialized(AttachedShadowElementContext context)
5860
{
5961
context.ClearAndDisposeResources();
6062
base.OnElementContextUninitialized(context);
6163
}
6264

65+
/// <inheritdoc/>
6366
protected override void OnPropertyChanged(AttachedShadowElementContext context, DependencyProperty property, object oldValue, object newValue)
6467
{
6568
if (property == CornerRadiusProperty)
@@ -78,6 +81,7 @@ protected override void OnPropertyChanged(AttachedShadowElementContext context,
7881
}
7982
}
8083

84+
/// <inheritdoc/>
8185
protected override CompositionBrush GetShadowMask(AttachedShadowElementContext context)
8286
{
8387
if (!SupportsCompositionVisualSurface)
@@ -115,6 +119,7 @@ protected override CompositionBrush GetShadowMask(AttachedShadowElementContext c
115119
return surfaceBrush;
116120
}
117121

122+
/// <inheritdoc/>
118123
protected override CompositionClip GetShadowClip(AttachedShadowElementContext context)
119124
{
120125
var pathGeom = context.GetResource(PathGeometryResourceKey) ??
@@ -141,6 +146,7 @@ protected override CompositionClip GetShadowClip(AttachedShadowElementContext co
141146
return clip;
142147
}
143148

149+
/// <inheritdoc/>
144150
protected override void OnSizeChanged(AttachedShadowElementContext context, Size newSize, Size previousSize)
145151
{
146152
var sizeAsVec2 = newSize.ToVector2();

Microsoft.Toolkit.Uwp.UI/Shadows/AttachedShadowBase.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public abstract class AttachedShadowBase : DependencyObject
4646
DependencyProperty.Register(nameof(Opacity), typeof(double), typeof(AttachedShadowBase), new PropertyMetadata(1d, OnDependencyPropertyChanged));
4747

4848
/// <summary>
49-
/// Returns whether or not this <see cref="AttachedShadowBase"/> implementation is supported on the current platform.
49+
/// Gets a value indicating whether or not this <see cref="AttachedShadowBase"/> implementation is supported on the current platform.
5050
/// </summary>
5151
public abstract bool IsSupported { get; }
5252

@@ -56,7 +56,7 @@ public abstract class AttachedShadowBase : DependencyObject
5656
private ConditionalWeakTable<FrameworkElement, AttachedShadowElementContext> ShadowElementContextTable { get; set; }
5757

5858
/// <summary>
59-
/// Gets or set the blur radius of the shadow.
59+
/// Gets or sets the blur radius of the shadow.
6060
/// </summary>
6161
public double BlurRadius
6262
{
@@ -92,7 +92,7 @@ public Color Color
9292
}
9393

9494
/// <summary>
95-
/// Returns whether or not OnSizeChanged should be called when <see cref="FrameworkElement.SizeChanged"/> is fired.
95+
/// Gets a value indicating whether or not OnSizeChanged should be called when <see cref="FrameworkElement.SizeChanged"/> is fired.
9696
/// </summary>
9797
protected internal abstract bool SupportsOnSizeChangedEvent { get; }
9898

@@ -155,6 +155,7 @@ protected internal virtual void OnElementContextUninitialized(AttachedShadowElem
155155
/// <summary>
156156
/// Get the associated <see cref="AttachedShadowElementContext"/> for the specified <see cref="FrameworkElement"/>.
157157
/// </summary>
158+
/// <returns>The <see cref="AttachedShadowElementContext"/> for the element.</returns>
158159
public AttachedShadowElementContext GetElementContext(FrameworkElement element)
159160
{
160161
if (ShadowElementContextTable != null && ShadowElementContextTable.TryGetValue(element, out var context))

Microsoft.Toolkit.Uwp.UI/Shadows/AttachedShadowElementContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ public void ClearAndDisposeResources()
279279
{
280280
(kvp.Value as IDisposable)?.Dispose();
281281
}
282+
282283
_resources.Clear();
283284
}
284285
}

0 commit comments

Comments
 (0)