2015-04-12 41 views
1

我有一個在ListView項目上打開的菜單彈出窗口。彈出菜單的默認動畫是否有更改默認打開動畫的方式?如何更改彈出菜單的打開動畫

編輯

我使用以下依賴屬性顯示在列表視圖項上下文菜單中它工作正常,但當顯示上下文菜單,它擠壓整個視圖一點。當打開上下文菜單時,我不想擠壓頁面。

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

} 

列表項數據模板

<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> 
+0

請添加您的XAML代碼中的問題。 –

回答

1

呀,你需要在你的資源

<Style TargetType="MenuFlyoutPresenter"> 

創建一個新的風格定位MenuFlyoutPresenter如果從程序文件複製它(X86)\ Windows Phone Kits \ 8.1 \ Include \ abi \ Xaml \ Design \ generic.xaml,你會發現裏面已經有了一些爲了獲得不同的動畫而需要改變的視覺狀態的故事板。

我寫在我的博客非常類似的東西張貼MenuFlyout flip animation on Windows Phone WinRT

+0

非常感謝@igrali,現在可以更改彈出式動畫。我還有一個問題。我在菜單彈出菜單默認打開時,我在listview保持事件上使用了彈出窗口(請參閱問題更新),所有頁面都擠了一點。我希望在彈出窗口被選中時頁面不會被擠壓。在那裏 –