New "Auto Close" feature for flyouts
It would be nice to be able to set a TimeSpan on a Flyout that would make it auto close after that amount of time. With this feature flyouts could be used for notifications more easily.
If you're using the Flyout for notifications, you're probably using a method that sets the notification message and opens the Flyout.
I've been using this method in another (private) project for displaying a status to the user; you might find it helpful. Status is the Flyout that is being used as a notification. I call this every time I want to display a notification.
using System.Windows.Media.Animation;
public void ShowStatus(string status, double duration = 2.5)
{
Status.Header = status;
BooleanAnimationUsingKeyFrames statusAnimation = new BooleanAnimationUsingKeyFrames();
statusAnimation.KeyFrames.Add(new DiscreteBooleanKeyFrame() { KeyTime = TimeSpan.FromSeconds(0), Value = true });
statusAnimation.KeyFrames.Add(new DiscreteBooleanKeyFrame() { KeyTime = TimeSpan.FromSeconds(duration + 0.5), Value = false }); //That 0.5 is for the Show animation
Status.BeginAnimation(MahApps.Metro.Controls.Flyout.IsOpenProperty, statusAnimation);
}
added with https://github.com/MahApps/MahApps.Metro/commit/8a77e75e0f095a46dfc8ae90430b7bfbe8311c45