Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New "Auto Close" feature for flyouts #1710

Closed
mgnslndh opened this issue Dec 18, 2014 · 2 comments
Closed

New "Auto Close" feature for flyouts #1710

mgnslndh opened this issue Dec 18, 2014 · 2 comments

Comments

@mgnslndh
Copy link
Contributor

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.

@punker76 punker76 self-assigned this Dec 18, 2014
@Dotnetifier
Copy link
Contributor

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);
}

Sikta added a commit to DoloSoftware/MahApps.Metro that referenced this issue Nov 23, 2015
Add IsAutoCloseEnabled and AutoCloseInterval DependencyProperties to the Flyout control. It is using a DispatcherTimer to close the Flyout.
@punker76 punker76 added this to the 1.3.0 milestone Jan 27, 2016
@punker76
Copy link
Member

added with 8a77e75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants