<Window x:Class="rotat.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <Storyboard x:Key="sbdRotation" RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetName="image" Storyboard.TargetProperty="(Image.LayoutTransform).(RotateTransform.Angle)" From="0" To="360" Duration="0:0:0:1" FillBehavior="Stop"/> </Storyboard> </Window.Resources> <Grid> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <Image Name="image" Width="50" Height="50" Source="C:\Users\shreddy.FAREAST\Pictures\disk1.png"> <Image.LayoutTransform> <RotateTransform CenterX="0.5" CenterY="0.5" /> </Image.LayoutTransform> </Image> <Button Grid.Row="1" Content="Rotate the image!" Click="Button_Click" Width="100" Height="100" Margin="106,30,311,29" /> <Button x:Name="stop" Width="100" Height="100" Margin="308,20,109,39" Grid.Row="1" Click="stop_Click" Content="stop"/> </Grid> </Window>
public MainWindow() { InitializeComponent(); sd = new Storyboard(); sd = (Storyboard)FindResource("sbdRotation"); } public void Button_Click(object sender, RoutedEventArgs args) { //while (mn>0) //{ sd.Begin(this); mn--; d++; // } } private void stop_Click(object sender, RoutedEventArgs e) { sd.Stop(this); }
sd.Begin(this,true);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)