2017-06-25 23:05:48 +02:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2024-02-03 21:01:53 +01:00
|
|
|
|
// Copyright © 2024 Clemens Fischer
|
2012-11-22 21:42:29 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
2021-06-14 21:41:37 +02:00
|
|
|
|
#if WINUI
|
|
|
|
|
|
using Microsoft.UI.Xaml;
|
|
|
|
|
|
using Microsoft.UI.Xaml.Media.Animation;
|
|
|
|
|
|
#else
|
2012-11-22 21:42:29 +01:00
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
|
using Windows.UI.Xaml.Media.Animation;
|
2021-06-14 21:41:37 +02:00
|
|
|
|
#endif
|
2012-11-22 21:42:29 +01:00
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2021-01-17 23:46:24 +01:00
|
|
|
|
internal static class Animatable
|
2012-11-22 21:42:29 +01:00
|
|
|
|
{
|
2024-05-21 13:51:10 +02:00
|
|
|
|
public static void BeginAnimation(this DependencyObject obj, string property, Timeline animation)
|
2012-11-22 21:42:29 +01:00
|
|
|
|
{
|
2024-05-21 13:51:10 +02:00
|
|
|
|
Storyboard.SetTargetProperty(animation, property);
|
|
|
|
|
|
Storyboard.SetTarget(animation, obj);
|
2012-11-22 21:42:29 +01:00
|
|
|
|
|
2024-05-21 13:51:10 +02:00
|
|
|
|
var storyboard = new Storyboard();
|
|
|
|
|
|
storyboard.Children.Add(animation);
|
|
|
|
|
|
storyboard.Begin();
|
|
|
|
|
|
}
|
2017-08-04 21:38:58 +02:00
|
|
|
|
|
2024-05-21 13:51:10 +02:00
|
|
|
|
public static void BeginAnimation(this DependencyObject obj, DependencyProperty property, Timeline animation)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (animation != null && property == UIElement.OpacityProperty)
|
|
|
|
|
|
{
|
|
|
|
|
|
BeginAnimation(obj, nameof(UIElement.Opacity), animation);
|
2016-07-03 00:32:11 +02:00
|
|
|
|
}
|
2012-11-22 21:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|