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

33 lines
935 B
C#
Raw Normal View History

2024-05-21 22:05:01 +02:00
// 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
{
2024-08-31 11:55:59 +02:00
public static Task SwapOpacitiesAsync(UIElement topElement, UIElement bottomElement)
2024-05-21 22:05:01 +02:00
{
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
});
2024-08-31 11:55:59 +02:00
return Task.CompletedTask;
2024-05-21 22:05:01 +02:00
}
}
}