Moved the ScrollViewer expression animation extensions

This commit is contained in:
Sergio Pedri 2020-12-28 00:32:54 +01:00
Родитель 7262c7c97f
Коммит cedbbf73b0
5 изменённых файлов: 11 добавлений и 28 удалений

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

@ -4,6 +4,8 @@
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Uwp.SampleApp.Models;
using Microsoft.Toolkit.Uwp.UI.Animations;
using Microsoft.Toolkit.Uwp.UI.Animations.Extensions;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

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

@ -22,7 +22,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
/// <summary>
/// The Z axis (depth).
/// </summary>
/// <remarks>This axis might only be available in certain scenarios, such as when working with composition APIs.</remarks>
/// <remarks>
/// This axis might only be available in certain scenarios, such as when working with composition APIs.
/// </remarks>
Z
}
}

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

@ -4,7 +4,7 @@
using Windows.UI.Composition;
namespace Microsoft.Toolkit.Uwp.UI.Extensions
namespace Microsoft.Toolkit.Uwp.UI.Animations
{
/// <summary>
/// Indicates a property of a <see cref="Visual"/> object.

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

@ -2,14 +2,14 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Numerics;
using Microsoft.Toolkit.Diagnostics;
using Windows.UI.Composition;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Hosting;
namespace Microsoft.Toolkit.Uwp.UI.Extensions
namespace Microsoft.Toolkit.Uwp.UI.Animations.Extensions
{
/// <summary>
/// Provides attached dependency properties and methods for the <see cref="ScrollViewer"/> control.
@ -50,7 +50,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Extensions
VisualProperty property = VisualProperty.Translation)
{
CompositionPropertySet scrollSet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scroller);
ExpressionAnimation animation = scrollSet.Compositor.CreateExpressionAnimation($"{nameof(scroller)}.{nameof(UIElement.Translation)}.{sourceAxis}");
animation.SetReferenceParameter(nameof(scroller), scrollSet);
@ -66,7 +65,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Extensions
case VisualProperty.Offset:
visual.StartAnimation($"{nameof(Visual.Offset)}.{targetAxis}", animation);
break;
default: throw new ArgumentException($"Invalid target property: {property}", nameof(property));
default:
ThrowHelper.ThrowArgumentException("Invalid target property");
break;
}
return animation;

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

@ -1,22 +0,0 @@
// 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.
namespace Microsoft.Toolkit.Uwp.UI.Extensions
{
/// <summary>
/// Indicates an axis in the 2D space
/// </summary>
public enum Axis
{
/// <summary>
/// The X axis (horizontal)
/// </summary>
X,
/// <summary>
/// The Y axis (vertical)
/// </summary>
Y
}
}