-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Flyout Animation Problem MahApps #1655
Comments
@ferrann which version? if you use 0.14 try using the latest alpha and chekc again. thx |
I dont know what is alpha. It seems something like the newest versions right? Thank you @punker76 |
Hi @ferrann Go to Manage NuGet Packages By right clicking References --> Click updates There will be drop down with stable only and Include Pre-Releases --> Select Include Pre-Releases When Pre-Release Pops up --- Click Update 👍 |
I've experienced the same issue. The animation runs only if view.Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, (Action)(() => flyout.IsOpen = true)); |
Finally the solution of that issue was that @thoemmi said. Im going to attach that solution adapted to my code for if someone wants to test it: public void OpenCloseFlyout(int n) Thank you guys, thats an excellent community. |
@ferrann @thoemmi i have added a command example to the flyout window and all works fine :-( https://github.com/MahApps/MahApps.Metro/blob/master/samples/MetroDemo/ExampleWindows/FlyoutDemo.xaml#L305 |
@punker76 See https://github.com/MahApps/MahApps.Metro/blob/master/samples/MetroDemo/ExampleWindows/FlyoutDemo.xaml.cs#L132-133, which I added in 1a88a84 . Replace these two lines with |
@thoemmi my mistake |
@ferrann Just for reference, see https://github.com/MahApps/MahApps.Metro/blob/master/samples/MetroDemo/ExampleWindows/FlyoutDemo.xaml.cs#L115-L134 on how to add a |
@thoemmi ok, maybe we can do the private static void IsOpenedChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
var flyout = (Flyout)dependencyObject;
Action a = () => {
if (e.NewValue != e.OldValue)
{
if ((bool)e.NewValue)
{
if (flyout.hideStoryboard != null)
{
// don't let the storyboard end it's completed event
// otherwise it could be hidden on start
flyout.hideStoryboard.Completed -= flyout.HideStoryboard_Completed;
}
flyout.Visibility = Visibility.Visible;
flyout.ApplyAnimation(flyout.Position, flyout.AnimateOpacity);
}
else
{
if (flyout.hideStoryboard != null)
{
flyout.hideStoryboard.Completed += flyout.HideStoryboard_Completed;
}
else
{
flyout.Hide();
}
}
VisualStateManager.GoToState(flyout, (bool)e.NewValue == false ? "Hide" : "Show", true);
}
flyout.RaiseEvent(new RoutedEventArgs(IsOpenChangedEvent));
};
flyout.Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, a);
} i found no issue with this /cc @flagbug |
Maybe |
Hi guys, Im trying to create your Flyouts with dynamic content and I have a little issue when the Flyout is executed for the first time. When I press a button that shows the Flyout I mentioned before, the flyout appears without the slide-fade default animation.
However, If I close the Flyout or I try to open the same Flyout again the animations works perfectly. I wasted many time trying to fix this, but I dont know whats going wrong and moreover I tryied to create a new project simulating the same process and it works perfectly .
I have an empty MainWindow that his content is an User Control "Menu" with some buttons. When I press one of the buttons the "Menu" shows a Flyout that have content from another User Control.
My MainWindow.xaml:
MainWindow constructor:
In my MainWindowViewModel I also have:
And Finally I have a MenuWindow that contains a Button with a Command attached to a function that calls the MainWindowViewModel OpenCloseFlyout(0) function:
The text was updated successfully, but these errors were encountered: