Rename Shadows.Attached to Effects.Shadow

This commit is contained in:
michael-hawker 2021-08-12 17:06:01 -07:00
Родитель f48df97bc1
Коммит 75e53c9116
3 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -12,13 +12,13 @@
<Grid>
<Button Content="Hello Shadows!" HorizontalAlignment="Center" VerticalAlignment="Center"
CornerRadius="8">
<ui:Shadows.Attached>
<ui:Effects.Shadow>
<media:AttachedCardShadow BlurRadius="@[BlurRadius:DoubleSlider:8.0:0.0-10.0]"
CornerRadius="8"
Color="@[Color:Brush:Black]"
Offset="@[Offset:Vector3:16,16]"
Opacity="@[Opacity:DoubleSlider:1.0:0.0-1.0]"/>
</ui:Shadows.Attached>
</ui:Effects.Shadow>
</Button>
</Grid>
</Page>

Просмотреть файл

@ -51,7 +51,7 @@
<controls:ConstrainedBox x:Key="ConstrainedBoxControl" />
<media:AttachedCardShadow x:Key="AttachedShadow" />
<controls:DropShadowPanel x:Key="DropShadowPanel"
ui:Shadows.Attached="{StaticResource AttachedShadow}" />
ui:Effects.Shadow="{StaticResource AttachedShadow}" />
</Page.Resources>
<Grid>

Просмотреть файл

@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
@ -9,33 +9,33 @@ namespace Microsoft.Toolkit.Uwp.UI
/// <summary>
/// Helper class for attaching <see cref="AttachedShadowBase"/> shadows to <see cref="FrameworkElement"/>s.
/// </summary>
public static class Shadows
public static class Effects
{
/// <summary>
/// Gets the shadow attached to a <see cref="FrameworkElement"/> by getting the value of the <see cref="AttachedProperty"/> property.
/// Gets the shadow attached to a <see cref="FrameworkElement"/> by getting the value of the <see cref="ShadowProperty"/> property.
/// </summary>
/// <param name="obj">The <see cref="FrameworkElement"/> the <see cref="AttachedShadowBase"/> is attached to.</param>
/// <returns>The <see cref="AttachedShadowBase"/> that is attached to the <paramref name="obj">FrameworkElement.</paramref></returns>
public static AttachedShadowBase GetAttached(FrameworkElement obj)
public static AttachedShadowBase GetShadow(FrameworkElement obj)
{
return (AttachedShadowBase)obj.GetValue(AttachedProperty);
return (AttachedShadowBase)obj.GetValue(ShadowProperty);
}
/// <summary>
/// Attaches a shadow to an element by setting the <see cref="AttachedProperty"/> property.
/// Attaches a shadow to an element by setting the <see cref="ShadowProperty"/> property.
/// </summary>
/// <param name="obj">The <see cref="FrameworkElement"/> to attach the shadow to.</param>
/// <param name="value">The <see cref="AttachedShadowBase"/> that will be attached to the element</param>
public static void SetAttached(FrameworkElement obj, AttachedShadowBase value)
public static void SetShadow(FrameworkElement obj, AttachedShadowBase value)
{
obj.SetValue(AttachedProperty, value);
obj.SetValue(ShadowProperty, value);
}
/// <summary>
/// Attached <see cref="DependencyProperty"/> for setting an <see cref="AttachedShadowBase"/> to a <see cref="FrameworkElement"/>.
/// </summary>
public static readonly DependencyProperty AttachedProperty =
DependencyProperty.RegisterAttached("Attached", typeof(AttachedShadowBase), typeof(Shadows), new PropertyMetadata(null, OnShadowChanged));
public static readonly DependencyProperty ShadowProperty =
DependencyProperty.RegisterAttached("Shadow", typeof(AttachedShadowBase), typeof(Effects), new PropertyMetadata(null, OnShadowChanged));
private static void OnShadowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{