积极答复者
请问storybord的targetproperty该怎样设置?

问题
答案
-
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SilverlightApplication2.MainControl" Width="640" Height="480"> <UserControl.Resources> <Storyboard x:Name="mystorybord"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="myimage" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)"> <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/> <EasingDoubleKeyFrame KeyTime="00:00:05" Value="179"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <Rectangle x:Name="myimage" Fill="#FFE94545" Stroke="#FF000000" Height="48" HorizontalAlignment="Left" Margin="145,192,0,0" VerticalAlignment="Top" Width="147" MouseLeftButtonDown="myimage_MouseLeftButtonDown"> <Rectangle.Projection> <PlaneProjection/> </Rectangle.Projection> </Rectangle> </Grid> </UserControl>
cs文件:
namespace SilverlightApplication2 { public partial class MainControl : UserControl { public MainControl() { // Required to initialize variables InitializeComponent(); } private void myimage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { mystorybord.Begin(); } } }
- 已标记为答案 李庆_八爪熊Moderator 2009年5月6日 1:27
全部回复
-
PlaneProjection.RotationXProperty
我这样写对吗?
xaml文件:
<UserControl x:Class="SilverlightApplication2.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.Resources>
<Storyboard x:Name="mystorybord">
<DoubleAnimation Storyboard.TargetName="myimage" Storyboard.TargetProperty="PlaneProjection.RotationXProperty" Duration="0:0:5" From="0" To="180"/>
</Storyboard>
</Grid.Resources>
<Image x:Name="myimage" Source="test.jpg" Width="600" Height="500" MouseLeftButtonDown="myimage_MouseLeftButtonDown"/>
</Grid>
</UserControl>
cs文件:
namespace SilverlightApplication2
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}private void myimage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
mystorybord.Begin();
}
}
}
但是这样我把鼠标点击以后没反应啊?
stoneluo -
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SilverlightApplication2.MainControl" Width="640" Height="480"> <UserControl.Resources> <Storyboard x:Name="mystorybord"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="myimage" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)"> <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/> <EasingDoubleKeyFrame KeyTime="00:00:05" Value="179"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <Rectangle x:Name="myimage" Fill="#FFE94545" Stroke="#FF000000" Height="48" HorizontalAlignment="Left" Margin="145,192,0,0" VerticalAlignment="Top" Width="147" MouseLeftButtonDown="myimage_MouseLeftButtonDown"> <Rectangle.Projection> <PlaneProjection/> </Rectangle.Projection> </Rectangle> </Grid> </UserControl>
cs文件:
namespace SilverlightApplication2 { public partial class MainControl : UserControl { public MainControl() { // Required to initialize variables InitializeComponent(); } private void myimage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { mystorybord.Begin(); } } }
- 已标记为答案 李庆_八爪熊Moderator 2009年5月6日 1:27