【发布时间】:2018-06-30 02:39:38
【问题描述】:
我有一个与下图非常相似的菜单。菜单项位于仪表板面板的左侧。
代码。
<Border Name="border">
<Border.Triggers>
<EventTrigger RoutedEvent="PreviewMouseLeftButtonDown">
<BeginStoryboard x:Name="MouseDown_BeginStoryboard">
<Storyboard>
<ColorAnimation Duration="0:0:0" .../><!--Change Background and Foreground if hover-->
</EventTrigger>
</Border.Triggers>
<Button>
<Button.Template>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="SomePlace" /> <!--Change Background and Foreground if hover-->
<TextBlock Grid.Column="1" Text="Hello" /> <!--Change Background and Foreground if hover-->
<TextBlock Grid.Column="2" Text="World" /> <!--Change Background and Foreground if hover-->
</Grid>
</ControlTemplate>
</Button>
</Border>
但我认为ColorAnimation 做不到。也许ColorAnimationUsingKeyFrames?
【问题讨论】:
-
你想要按钮边框的动画吗?