This repository was archived by the owner on Mar 15, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathExtensions.WinRT.cs
More file actions
56 lines (49 loc) · 1.82 KB
/
Extensions.WinRT.cs
File metadata and controls
56 lines (49 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © 2014 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;
namespace MapControl
{
internal static partial class Extensions
{
public static Point Transform(this GeneralTransform transform, Point point)
{
return transform.TransformPoint(point);
}
public static void BeginAnimation(this DependencyObject obj, DependencyProperty property, DoubleAnimation animation)
{
animation.EnableDependentAnimation = true;
if (property == UIElement.OpacityProperty)
{
BeginAnimation(obj, "Opacity", animation);
}
else if (property == MapBase.ZoomLevelProperty)
{
BeginAnimation(obj, "ZoomLevel", animation);
}
else if (property == MapBase.HeadingProperty)
{
BeginAnimation(obj, "Heading", animation);
}
}
public static void BeginAnimation(this DependencyObject obj, DependencyProperty property, PointAnimation animation)
{
animation.EnableDependentAnimation = true;
if (property == MapBase.CenterPointProperty)
{
BeginAnimation(obj, "CenterPoint", animation);
}
}
private static void BeginAnimation(DependencyObject obj, string property, Timeline animation)
{
Storyboard.SetTargetProperty(animation, property);
Storyboard.SetTarget(animation, obj);
var storyboard = new Storyboard();
storyboard.Children.Add(animation);
storyboard.Begin();
}
}
}