XAML-Map-Control/MapControl/WPF/MapImageLayer.WPF.cs

41 lines
1.2 KiB
C#
Raw Normal View History

2024-05-21 22:05:01 +02:00
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
2025-01-01 18:57:55 +01:00
// Copyright © Clemens Fischer
2024-05-21 22:05:01 +02:00
// Licensed under the Microsoft Public License (Ms-PL)
using System;
2025-01-25 16:47:42 +01:00
using System.Windows;
2024-05-21 22:05:01 +02:00
using System.Windows.Media.Animation;
namespace MapControl
{
2025-01-05 09:22:50 +01:00
public partial class MapImageLayer
2024-05-21 22:05:01 +02:00
{
2025-01-25 16:47:42 +01:00
private void FadeOver()
2024-05-21 22:05:01 +02:00
{
2025-01-05 10:31:15 +01:00
var fadeInAnimation = new DoubleAnimation
2024-05-21 22:05:01 +02:00
{
To = 1d,
Duration = MapBase.ImageFadeDuration
2025-01-05 10:31:15 +01:00
};
2024-05-21 22:05:01 +02:00
2025-01-05 10:31:15 +01:00
var fadeOutAnimation = new DoubleAnimation
2024-05-21 22:05:01 +02:00
{
To = 0d,
BeginTime = MapBase.ImageFadeDuration,
2025-01-24 23:04:59 +01:00
Duration = TimeSpan.Zero
2025-01-05 10:31:15 +01:00
};
2025-01-25 16:47:42 +01:00
Storyboard.SetTarget(fadeInAnimation, Children[1]);
Storyboard.SetTargetProperty(fadeInAnimation, new PropertyPath(OpacityProperty));
Storyboard.SetTarget(fadeOutAnimation, Children[0]);
Storyboard.SetTargetProperty(fadeOutAnimation, new PropertyPath(OpacityProperty));
var storyboard = new Storyboard();
storyboard.Children.Add(fadeInAnimation);
storyboard.Children.Add(fadeOutAnimation);
storyboard.Begin();
2024-05-21 22:05:01 +02:00
}
}
}