在WPF中的Menustrip

时间:2009-07-30 13:11:23

标签: wpf menu menuitem

当鼠标聚焦在菜单条上时,我正在寻找向右侧滑动的菜单项(菜单条应该是垂直样式)?

1 个答案:

答案 0 :(得分:0)

对RoutedEvent MouseEnter使用EventTrigger。在触发器内部,设置一个Storyboard,它将为MenuItem的TranslateTransform属性设置动画。像这样:

<EventTrigger RoutedEvent="MenuItem.MouseEnter">
   <EventTrigger.Actions>
      <BeginStoryboard>
         <Storyboard>
            <DoubleAnimation
             Storyboard.TargetProperty="RenderTransform.(TranslateTransform.X)"
             From="0" To="100"/>
         </Storyboard>
      </BeginStoryboard>
   </EventTrigger.Actions>
</EventTrigger>