Muhammad Saifullah
Muhammad Saifullah

Reputation: 4292

How to change open animation of flyout menu

I have a menu flyout which is opened on ListView Items. The default open animation is quite slow is there a way to change the default animation of flyout menu?

EDIT

I am using following dependency property for showing context menu on list view item it works fine but when context menu is shown it squeezes the the whole view a bit. I do not want to squeeze the page when context menu is opened.

 public class OpenMenuFlyoutAction:DependencyObject,IAction
{

    public object Execute(object sender, object parameter)
    {
        if (!Global.IsDisabledShowContextMenuOnListView)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
        return null;
    }

}

List Item data template

 <DataTemplate x:Key="MemberListItemDataTemplate">
    <Grid Width="{Binding ElementName=searchView,Path=ActualWidth}" Background="{Binding ItemBackground}"
          Margin="0,0,0,20" Height="auto">
        <i:Interaction.Behaviors>
            <icore:EventTriggerBehavior EventName="Holding">
                <helpers:OpenMenuFlyoutAction />
            </icore:EventTriggerBehavior>
        </i:Interaction.Behaviors>
        <FlyoutBase.AttachedFlyout>
            <MenuFlyout>

                <MenuFlyoutItem Text="share" RequestedTheme="Dark" Command="{Binding ElementName=pageMyProfile, Path=DataContext.ShareMemberDetails}" CommandParameter="{Binding item99}" />
                <MenuFlyoutItem Text="reomve from members" RequestedTheme="Dark" Command="{Binding ElementName=pageMyProfile, Path=DataContext.RemoveMember}" CommandParameter="{Binding item99}" />
            </MenuFlyout>
        </FlyoutBase.AttachedFlyout>
  ...
  </DataTemplate>

Upvotes: 1

Views: 1019

Answers (1)

Igor Ralic
Igor Ralic

Reputation: 15006

Yeah, you need to create a new Style targeting MenuFlyoutPresenter in your resources

<Style TargetType="MenuFlyoutPresenter"> 

If you copy it from Program Files (x86)\Windows Phone Kits\8.1\Include\abi\Xaml\Design\generic.xaml you'll notice there are already some storyboards inside for various visual states that you need to change in order to get a different animation.

I wrote about something very similar in my blog post MenuFlyout flip animation on Windows Phone WinRT

Upvotes: 1

Related Questions