XAML-Map-Control/MapControl/WPF/OpacityHelper.WPF.cs
ClemensFischer 560f44a139 Copyright
2025-01-01 18:57:55 +01:00

33 lines
930 B
C#

// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// Copyright © 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 Task SwapOpacitiesAsync(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
});
return Task.CompletedTask;
}
}
}