@@ -16,16 +16,29 @@ namespace Microsoft.Toolkit.Uwp.UI
16
16
/// </summary>
17
17
public abstract class AttachedShadowBase : DependencyObject
18
18
{
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 )
20
25
{
21
26
return ( AttachedShadowBase ) obj . GetValue ( ShadowProperty ) ;
22
27
}
23
28
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 )
25
35
{
26
36
obj . SetValue ( ShadowProperty , value ) ;
27
37
}
28
38
39
+ /// <summary>
40
+ /// Backing dependency property used to attach shadows to UI elements.
41
+ /// </summary>
29
42
public static readonly DependencyProperty ShadowProperty =
30
43
DependencyProperty . RegisterAttached ( "Shadow" , typeof ( AttachedShadowBase ) , typeof ( AttachedShadowBase ) , new PropertyMetadata ( null , OnShadowChanged ) ) ;
31
44
@@ -47,34 +60,46 @@ private static void OnShadowChanged(DependencyObject d, DependencyPropertyChange
47
60
}
48
61
}
49
62
63
+ /// <summary>
64
+ /// The <see cref="DependencyProperty"/> for <see cref="BlurRadius"/>.
65
+ /// </summary>
50
66
public static readonly DependencyProperty BlurRadiusProperty =
51
67
DependencyProperty . Register ( nameof ( BlurRadius ) , typeof ( double ) , typeof ( AttachedShadowBase ) , new PropertyMetadata ( 12d , OnDependencyPropertyChanged ) ) ;
52
68
69
+ /// <summary>
70
+ /// The <see cref="DependencyProperty"/> for <see cref="Color"/>.
71
+ /// </summary>
53
72
public static readonly DependencyProperty ColorProperty =
54
73
DependencyProperty . Register ( nameof ( Color ) , typeof ( Color ) , typeof ( AttachedShadowBase ) , new PropertyMetadata ( Colors . Black , OnDependencyPropertyChanged ) ) ;
55
74
75
+ /// <summary>
76
+ /// The <see cref="DependencyProperty"/> for <see cref="Opacity"/>.
77
+ /// </summary>
56
78
public static readonly DependencyProperty OffsetProperty =
57
79
DependencyProperty . Register (
58
80
nameof ( Offset ) ,
59
81
typeof ( Vector3 ) ,
60
82
typeof ( AttachedShadowBase ) ,
61
83
new PropertyMetadata ( Vector3 . Zero , OnDependencyPropertyChanged ) ) ;
62
84
85
+ /// <summary>
86
+ /// The <see cref="DependencyProperty"/> for <see cref="Opacity"/>
87
+ /// </summary>
63
88
public static readonly DependencyProperty OpacityProperty =
64
89
DependencyProperty . Register ( nameof ( Opacity ) , typeof ( double ) , typeof ( AttachedShadowBase ) , new PropertyMetadata ( 1d , OnDependencyPropertyChanged ) ) ;
65
90
66
91
/// <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.
68
93
/// </summary>
69
94
public abstract bool IsSupported { get ; }
70
95
71
96
/// <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.
73
98
/// </summary>
74
- protected ConditionalWeakTable < FrameworkElement , AttachedShadowElementContext > ShadowElementContextTable { get ; private set ; }
99
+ private ConditionalWeakTable < FrameworkElement , AttachedShadowElementContext > ShadowElementContextTable { get ; set ; }
75
100
76
101
/// <summary>
77
- /// Gets or set the blur radius of the shadow
102
+ /// Gets or set the blur radius of the shadow.
78
103
/// </summary>
79
104
public double BlurRadius
80
105
{
@@ -83,7 +108,7 @@ public double BlurRadius
83
108
}
84
109
85
110
/// <summary>
86
- /// Gets or sets the opacity of the shadow
111
+ /// Gets or sets the opacity of the shadow.
87
112
/// </summary>
88
113
public double Opacity
89
114
{
@@ -92,7 +117,7 @@ public double Opacity
92
117
}
93
118
94
119
/// <summary>
95
- /// Gets or sets the offset of the shadow
120
+ /// Gets or sets the offset of the shadow.
96
121
/// </summary>
97
122
public Vector3 Offset
98
123
{
@@ -101,7 +126,7 @@ public Vector3 Offset
101
126
}
102
127
103
128
/// <summary>
104
- /// Gets or sets the color of the shadow
129
+ /// Gets or sets the color of the shadow.
105
130
/// </summary>
106
131
public Color Color
107
132
{
@@ -110,9 +135,9 @@ public Color Color
110
135
}
111
136
112
137
/// <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.
114
139
/// </summary>
115
- public abstract bool SupportsOnSizeChangedEvent { get ; }
140
+ protected internal abstract bool SupportsOnSizeChangedEvent { get ; }
116
141
117
142
private void ConnectElement ( FrameworkElement element )
118
143
{
@@ -171,7 +196,7 @@ protected internal virtual void OnElementContextUninitialized(AttachedShadowElem
171
196
}
172
197
173
198
/// <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"/>.
175
200
/// </summary>
176
201
public AttachedShadowElementContext GetElementContext ( FrameworkElement element )
177
202
{
@@ -193,7 +218,7 @@ protected virtual void SetElementChildVisual(AttachedShadowElementContext contex
193
218
}
194
219
195
220
/// <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.
197
222
/// </summary>
198
223
protected static void OnDependencyPropertyChanged ( object sender , DependencyPropertyChangedEventArgs args )
199
224
{
@@ -217,7 +242,7 @@ private void CallPropertyChangedForEachElement(DependencyProperty property, obje
217
242
}
218
243
219
244
/// <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.
221
246
/// </summary>
222
247
protected virtual CompositionBrush GetShadowMask ( AttachedShadowElementContext context )
223
248
{
@@ -233,7 +258,7 @@ protected virtual CompositionClip GetShadowClip(AttachedShadowElementContext con
233
258
}
234
259
235
260
/// <summary>
236
- /// Update the mask that gives the shadow its shape
261
+ /// Update the mask that gives the shadow its shape.
237
262
/// </summary>
238
263
protected void UpdateShadowMask ( AttachedShadowElementContext context )
239
264
{
@@ -246,7 +271,7 @@ protected void UpdateShadowMask(AttachedShadowElementContext context)
246
271
}
247
272
248
273
/// <summary>
249
- /// Update the clipping on the shadow's <see cref="SpriteVisual"/>
274
+ /// Update the clipping on the shadow's <see cref="SpriteVisual"/>.
250
275
/// </summary>
251
276
protected void UpdateShadowClip ( AttachedShadowElementContext context )
252
277
{
@@ -259,7 +284,7 @@ protected void UpdateShadowClip(AttachedShadowElementContext context)
259
284
}
260
285
261
286
/// <summary>
262
- /// This method is called when a DependencyProperty is changed
287
+ /// This method is called when a DependencyProperty is changed.
263
288
/// </summary>
264
289
protected virtual void OnPropertyChanged ( AttachedShadowElementContext context , DependencyProperty property , object oldValue , object newValue )
265
290
{
@@ -287,11 +312,11 @@ protected virtual void OnPropertyChanged(AttachedShadowElementContext context, D
287
312
}
288
313
289
314
/// <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>.
291
316
/// </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>
295
320
protected internal virtual void OnSizeChanged ( AttachedShadowElementContext context , Size newSize , Size previousSize )
296
321
{
297
322
}
0 commit comments