本文介绍了无法使用简单的VisualStateManager来使用Silverlight 3和Expression Blend的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,周期几天我试图找出如何使VisualStateManager在一个简单的按钮上工作。我尝试了以下教程,但由于某种原因它仍然无效。

这是我在Expression Blend中创建visualstatemanager教程后创建的代码示例br />

Hi all,

For more than a few days I'm trying to figure out how to make the VisualStateManager work on a simple button.
I tried following tutorials but for some reason it still didn't work.

Here's an example for a code I created following a tutorial on creating a visualstatemanager in Expression Blend

<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	x:Class="VisualStateManager.MainPage"
	Width="640" Height="480">

	<Grid x:Name="LayoutRoot" Background="White">
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="VisualStateGroup">
				<VisualStateGroup.Transitions>
					<VisualTransition GeneratedDuration="00:00:03"/>
				</VisualStateGroup.Transitions>
				<VisualState x:Name="MouseOver">
					<Storyboard>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
							<EasingDoubleKeyFrame KeyTime="00:00:00" Value="152"/>
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
							<EasingDoubleKeyFrame KeyTime="00:00:00" Value="5"/>
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
	
		<Button x:Name="button" Height="101" Margin="174,112,204,0" VerticalAlignment="Top" Content="Button" RenderTransformOrigin="0.5,0.5">
			<Button.RenderTransform>
				<TransformGroup>
					<ScaleTransform/>
					<SkewTransform/>
					<RotateTransform/>
					<TranslateTransform/>
				</TransformGroup>
			</Button.RenderTransform>
		</Button>
	
	</Grid>
</UserControl>


这应该会移动MouseOver上的按钮,但它不起作用!

任何人都可以请帮助我这个?我做错了什么?

谢谢!
半恐怖

This is supposed to move the button on MouseOver, but it just doesn't work!

Can anyone please help me with this? What am I doing wrong?

Thanks!

Dror

推荐答案


这篇关于无法使用简单的VisualStateManager来使用Silverlight 3和Expression Blend的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 11:56