Skip to content

Commit 795c57e

Browse files
chris-blackmanmichael-hawker
authored andcommitted
Documentation update
1 parent ab486ec commit 795c57e

File tree

1 file changed

+46
-21
lines changed

1 file changed

+46
-21
lines changed

Microsoft.Toolkit.Uwp.UI/AttachedShadowBase.cs

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,29 @@ namespace Microsoft.Toolkit.Uwp.UI
1616
/// </summary>
1717
public abstract class AttachedShadowBase : DependencyObject
1818
{
19-
public static AttachedShadowBase GetShadow(DependencyObject obj)
19+
/// <summary>
20+
/// Gets the shadow attached to a <see cref="FrameworkElement"/> by getting the value of the <see cref="ShadowProperty"/> property.
21+
/// </summary>
22+
/// <param name="obj">The <see cref="FrameworkElement"/> the <see cref="AttachedShadowBase"/> is attached to.</param>
23+
/// <returns>The <see cref="AttachedShadowBase"/> that is attached to the <paramref name="obj">FrameworkElement.</paramref></returns>
24+
public static AttachedShadowBase GetShadow(FrameworkElement obj)
2025
{
2126
return (AttachedShadowBase)obj.GetValue(ShadowProperty);
2227
}
2328

24-
public static void SetShadow(DependencyObject obj, AttachedShadowBase value)
29+
/// <summary>
30+
/// Attaches a shadow to an element by setting the <see cref="ShadowProperty"/> property.
31+
/// </summary>
32+
/// <param name="obj">The <see cref="FrameworkElement"/> to attach the shadow to.</param>
33+
/// <param name="value">The <see cref="AttachedShadowBase"/> that will be attached to the element</param>
34+
public static void SetShadow(FrameworkElement obj, AttachedShadowBase value)
2535
{
2636
obj.SetValue(ShadowProperty, value);
2737
}
2838

39+
/// <summary>
40+
/// Backing dependency property used to attach shadows to UI elements.
41+
/// </summary>
2942
public static readonly DependencyProperty ShadowProperty =
3043
DependencyProperty.RegisterAttached("Shadow", typeof(AttachedShadowBase), typeof(AttachedShadowBase), new PropertyMetadata(null, OnShadowChanged));
3144

@@ -47,34 +60,46 @@ private static void OnShadowChanged(DependencyObject d, DependencyPropertyChange
4760
}
4861
}
4962

63+
/// <summary>
64+
/// The <see cref="DependencyProperty"/> for <see cref="BlurRadius"/>.
65+
/// </summary>
5066
public static readonly DependencyProperty BlurRadiusProperty =
5167
DependencyProperty.Register(nameof(BlurRadius), typeof(double), typeof(AttachedShadowBase), new PropertyMetadata(12d, OnDependencyPropertyChanged));
5268

69+
/// <summary>
70+
/// The <see cref="DependencyProperty"/> for <see cref="Color"/>.
71+
/// </summary>
5372
public static readonly DependencyProperty ColorProperty =
5473
DependencyProperty.Register(nameof(Color), typeof(Color), typeof(AttachedShadowBase), new PropertyMetadata(Colors.Black, OnDependencyPropertyChanged));
5574

75+
/// <summary>
76+
/// The <see cref="DependencyProperty"/> for <see cref="Opacity"/>.
77+
/// </summary>
5678
public static readonly DependencyProperty OffsetProperty =
5779
DependencyProperty.Register(
5880
nameof(Offset),
5981
typeof(Vector3),
6082
typeof(AttachedShadowBase),
6183
new PropertyMetadata(Vector3.Zero, OnDependencyPropertyChanged));
6284

85+
/// <summary>
86+
/// The <see cref="DependencyProperty"/> for <see cref="Opacity"/>
87+
/// </summary>
6388
public static readonly DependencyProperty OpacityProperty =
6489
DependencyProperty.Register(nameof(Opacity), typeof(double), typeof(AttachedShadowBase), new PropertyMetadata(1d, OnDependencyPropertyChanged));
6590

6691
/// <summary>
67-
/// Returns whether or not this <see cref="AttachedShadowBase"/> implementation is supported on the current platform
92+
/// Returns whether or not this <see cref="AttachedShadowBase"/> implementation is supported on the current platform.
6893
/// </summary>
6994
public abstract bool IsSupported { get; }
7095

7196
/// <summary>
72-
/// Returns the collection of <see cref="AttachedShadowElementContext"/> for each element this <see cref="AttachedShadowBase"/> is connected to
97+
/// Gets or sets the collection of <see cref="AttachedShadowElementContext"/> for each element this <see cref="AttachedShadowBase"/> is connected to.
7398
/// </summary>
74-
protected ConditionalWeakTable<FrameworkElement, AttachedShadowElementContext> ShadowElementContextTable { get; private set; }
99+
private ConditionalWeakTable<FrameworkElement, AttachedShadowElementContext> ShadowElementContextTable { get; set; }
75100

76101
/// <summary>
77-
/// Gets or set the blur radius of the shadow
102+
/// Gets or set the blur radius of the shadow.
78103
/// </summary>
79104
public double BlurRadius
80105
{
@@ -83,7 +108,7 @@ public double BlurRadius
83108
}
84109

85110
/// <summary>
86-
/// Gets or sets the opacity of the shadow
111+
/// Gets or sets the opacity of the shadow.
87112
/// </summary>
88113
public double Opacity
89114
{
@@ -92,7 +117,7 @@ public double Opacity
92117
}
93118

94119
/// <summary>
95-
/// Gets or sets the offset of the shadow
120+
/// Gets or sets the offset of the shadow.
96121
/// </summary>
97122
public Vector3 Offset
98123
{
@@ -101,7 +126,7 @@ public Vector3 Offset
101126
}
102127

103128
/// <summary>
104-
/// Gets or sets the color of the shadow
129+
/// Gets or sets the color of the shadow.
105130
/// </summary>
106131
public Color Color
107132
{
@@ -110,9 +135,9 @@ public Color Color
110135
}
111136

112137
/// <summary>
113-
/// Returns whether or not OnSizeChanged should be called when <see cref="FrameworkElement.SizeChanged"/> is fired
138+
/// Returns whether or not OnSizeChanged should be called when <see cref="FrameworkElement.SizeChanged"/> is fired.
114139
/// </summary>
115-
public abstract bool SupportsOnSizeChangedEvent { get; }
140+
protected internal abstract bool SupportsOnSizeChangedEvent { get; }
116141

117142
private void ConnectElement(FrameworkElement element)
118143
{
@@ -171,7 +196,7 @@ protected internal virtual void OnElementContextUninitialized(AttachedShadowElem
171196
}
172197

173198
/// <summary>
174-
/// Get the associated <see cref="AttachedShadowElementContext"/> for the specified <see cref="FrameworkElement"/>
199+
/// Get the associated <see cref="AttachedShadowElementContext"/> for the specified <see cref="FrameworkElement"/>.
175200
/// </summary>
176201
public AttachedShadowElementContext GetElementContext(FrameworkElement element)
177202
{
@@ -193,7 +218,7 @@ protected virtual void SetElementChildVisual(AttachedShadowElementContext contex
193218
}
194219

195220
/// <summary>
196-
/// Use this method as the <see cref="PropertyChangedCallback"/> for <see cref="DependencyProperty">DependencyProperties</see> in derived classes
221+
/// Use this method as the <see cref="PropertyChangedCallback"/> for <see cref="DependencyProperty">DependencyProperties</see> in derived classes.
197222
/// </summary>
198223
protected static void OnDependencyPropertyChanged(object sender, DependencyPropertyChangedEventArgs args)
199224
{
@@ -217,7 +242,7 @@ private void CallPropertyChangedForEachElement(DependencyProperty property, obje
217242
}
218243

219244
/// <summary>
220-
/// Get a <see cref="CompositionBrush"/> in the shape of the element that is casting the shadow
245+
/// Get a <see cref="CompositionBrush"/> in the shape of the element that is casting the shadow.
221246
/// </summary>
222247
protected virtual CompositionBrush GetShadowMask(AttachedShadowElementContext context)
223248
{
@@ -233,7 +258,7 @@ protected virtual CompositionClip GetShadowClip(AttachedShadowElementContext con
233258
}
234259

235260
/// <summary>
236-
/// Update the mask that gives the shadow its shape
261+
/// Update the mask that gives the shadow its shape.
237262
/// </summary>
238263
protected void UpdateShadowMask(AttachedShadowElementContext context)
239264
{
@@ -246,7 +271,7 @@ protected void UpdateShadowMask(AttachedShadowElementContext context)
246271
}
247272

248273
/// <summary>
249-
/// Update the clipping on the shadow's <see cref="SpriteVisual"/>
274+
/// Update the clipping on the shadow's <see cref="SpriteVisual"/>.
250275
/// </summary>
251276
protected void UpdateShadowClip(AttachedShadowElementContext context)
252277
{
@@ -259,7 +284,7 @@ protected void UpdateShadowClip(AttachedShadowElementContext context)
259284
}
260285

261286
/// <summary>
262-
/// This method is called when a DependencyProperty is changed
287+
/// This method is called when a DependencyProperty is changed.
263288
/// </summary>
264289
protected virtual void OnPropertyChanged(AttachedShadowElementContext context, DependencyProperty property, object oldValue, object newValue)
265290
{
@@ -287,11 +312,11 @@ protected virtual void OnPropertyChanged(AttachedShadowElementContext context, D
287312
}
288313

289314
/// <summary>
290-
/// This method is called when the element size changes, and <see cref="SupportsOnSizeChangedEvent"/> = <see cref="bool">true</see>
315+
/// This method is called when the element size changes, and <see cref="SupportsOnSizeChangedEvent"/> = <see cref="bool">true</see>.
291316
/// </summary>
292-
/// <param name="context"></param>
293-
/// <param name="newSize"></param>
294-
/// <param name="previousSize"></param>
317+
/// <param name="context">The <see cref="AttachedShadowElementContext"/> for the <see cref="FrameworkElement"/> firing its SizeChanged event</param>
318+
/// <param name="newSize">The new size of the <see cref="FrameworkElement"/></param>
319+
/// <param name="previousSize">The previous size of the <see cref="FrameworkElement"/></param>
295320
protected internal virtual void OnSizeChanged(AttachedShadowElementContext context, Size newSize, Size previousSize)
296321
{
297322
}

0 commit comments

Comments
 (0)