XAML-Map-Control/MapControl/WPF/OpacityHelper.WPF.cs
2024-05-21 22:05:01 +02:00

33 lines
935 B
C#

// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// Copyright © 2024 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Animation;
namespace MapControl
{
public static class OpacityHelper
{
public static async Task SwapOpacities(UIElement topElement, UIElement bottomElement)
{
topElement.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation
{
To = 1d,
Duration = MapBase.ImageFadeDuration
});
bottomElement.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation
{
To = 0d,
BeginTime = MapBase.ImageFadeDuration,
Duration = TimeSpan.Zero
});
await Task.CompletedTask;
}
}
}