mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 15:05:50 +00:00
Fixed Animatable
This commit is contained in:
parent
068a9ef8a6
commit
ad757def15
2 changed files with 2 additions and 2 deletions
50
MapControl/UWP/Animatable.UWP.cs
Normal file
50
MapControl/UWP/Animatable.UWP.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
||||
// © 2021 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Media.Animation;
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
internal static class Animatable
|
||||
{
|
||||
public static void BeginAnimation(this DependencyObject obj, DependencyProperty property, Timeline animation)
|
||||
{
|
||||
if (animation != null)
|
||||
{
|
||||
string propertyName = null;
|
||||
|
||||
if (property == MapBase.CenterPointProperty)
|
||||
{
|
||||
propertyName = "CenterPoint";
|
||||
((PointAnimation)animation).EnableDependentAnimation = true;
|
||||
}
|
||||
else if (property == MapBase.ZoomLevelProperty)
|
||||
{
|
||||
propertyName = "ZoomLevel";
|
||||
((DoubleAnimation)animation).EnableDependentAnimation = true;
|
||||
}
|
||||
else if (property == MapBase.HeadingProperty)
|
||||
{
|
||||
propertyName = "Heading";
|
||||
((DoubleAnimation)animation).EnableDependentAnimation = true;
|
||||
}
|
||||
else if (property == UIElement.OpacityProperty)
|
||||
{
|
||||
propertyName = "Opacity";
|
||||
}
|
||||
|
||||
if (propertyName != null)
|
||||
{
|
||||
Storyboard.SetTargetProperty(animation, propertyName);
|
||||
Storyboard.SetTarget(animation, obj);
|
||||
|
||||
var storyboard = new Storyboard();
|
||||
storyboard.Children.Add(animation);
|
||||
storyboard.Begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue