I am using Silverlight 3 - Visual studio 2010
I want animate button in Grid Load.
In Silverlight I am getting the error "Button Loaded value is out of range".
But the Same code is worked in WPF
To make this code to work in silverlight do i need to any change?
Please help.
<UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" x:Class="DataGridEx1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel>
<data:DataGrid x:Name="dataGrid" AutoGenerateColumns="False">
<data:DataGrid.Columns>
<data:DataGridTextColumn Binding="{Binding ID}" Header="ID" IsReadOnly="True"></data:DataGridTextColumn>
<data:DataGridTextColumn Binding="{Binding Name}" Header="Job Name" IsReadOnly="True"></data:DataGridTextColumn>
<data:DataGridTemplateColumn Header="Job Status">
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button VerticalAlignment="Center" Loaded="btnLayout_Loaded" Content="{Binding Des}" HorizontalAlignment="Left" Width="50" Height="20" Name="btnLayout">
<Button.RenderTransform>
<RotateTransform Angle="180" />
</Button.RenderTransform>
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(Button.RenderTransform).(RotateTransform.Angle)"
From="0" To="180" Duration="0:0:2" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
</data:DataGrid.Columns>
</data:DataGrid>
</StackPanel>
</Grid>
</UserControl>
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog