日期:2014-05-18 浏览次数:20682 次
<Window x:Class="CaseAnalysis_WPF_.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.Resources> <Style TargetType="FrameworkElement" x:Key="CircleGrid"> <Setter Property="RenderTransform"> <Setter.Value> <RotateTransform /> </Setter.Value> </Setter> <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/> </Style> <EventTrigger x:Key="CircleButtons" RoutedEvent="MouseEnter"> <BeginStoryboard> <Storyboard Name="Circle"> <DoubleAnimation From="0" To="3600" Duration="0:0:30" Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(RotateTransform.Angle)"/> </Storyboard> </BeginStoryboard> </EventTrigger> </Window.Resources> <Grid Style="{StaticResource CircleGrid}"> <Grid.Triggers> <StaticResource ResourceKey="CircleButtons"/> </Grid.Triggers> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="104,47,0,0" Name="button1" VerticalAlignment="Top" Width="75" /> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="33,119,0,0" Name="button2" VerticalAlignment="Top" Width="75" /> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="180,119,0,0" Name="button3" VerticalAlignment="Top" Width="75" /> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="104,200,0,0" Name="button4" VerticalAlignment="Top" Width="75" /> </Grid> </Window>
------解决方案--------------------