2017-06-25 23:05:48 +02:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2019-03-27 18:39:59 +01:00
|
|
|
|
// © 2019 Clemens Fischer
|
2012-11-22 21:42:29 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
|
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
|
using Windows.UI.Xaml.Media.Animation;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2014-10-30 16:27:36 +01:00
|
|
|
|
internal static class Extensions
|
2012-11-22 21:42:29 +01:00
|
|
|
|
{
|
2017-11-10 17:26:15 +01:00
|
|
|
|
public static void BeginAnimation(this DependencyObject obj, DependencyProperty property, Timeline animation)
|
2012-11-22 21:42:29 +01:00
|
|
|
|
{
|
2017-11-10 17:26:15 +01:00
|
|
|
|
if (animation != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
string propertyName = null;
|
2012-11-22 21:42:29 +01:00
|
|
|
|
|
2017-11-10 17:26:15 +01:00
|
|
|
|
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";
|
|
|
|
|
|
}
|
2016-07-03 00:32:11 +02:00
|
|
|
|
|
2017-11-10 17:26:15 +01:00
|
|
|
|
if (propertyName != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Storyboard.SetTargetProperty(animation, propertyName);
|
|
|
|
|
|
Storyboard.SetTarget(animation, obj);
|
2017-08-04 21:38:58 +02:00
|
|
|
|
|
2017-11-10 17:26:15 +01:00
|
|
|
|
var storyboard = new Storyboard();
|
|
|
|
|
|
storyboard.Children.Add(animation);
|
|
|
|
|
|
storyboard.Begin();
|
|
|
|
|
|
}
|
2016-07-03 00:32:11 +02:00
|
|
|
|
}
|
2012-11-22 21:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|