Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Pendulum Button

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       xmlns:s="clr-namespace:System;assembly=mscorlib">     <StackPanel Width="200">         <Line X1="100" X2="100" Y2="200"               StrokeThickness="3" Stroke="Black" />         <Button Content="{x:Static s:DateTime.Now}"                 HorizontalAlignment="Center" />         <StackPanel.RenderTransform>             <RotateTransform x:Name="xform" CenterX="100" />         </StackPanel.RenderTransform>         <StackPanel.Triggers>             <EventTrigger RoutedEvent="StackPanel.Loaded">                 <BeginStoryboard>                     <Storyboard TargetName="xform" TargetProperty="Angle">                         <DoubleAnimation From="-30" To="30" Duration="0:0:1"                                AccelerationRatio="0.5" DecelerationRatio="0.5"                               AutoReverse="True" RepeatBehavior="Forever" />                     </Storyboard>                 </BeginStoryboard>             </EventTrigger>         </StackPanel.Triggers>     </StackPanel> </Page>