SilverLight中的视觉状态?(我们如何使用它)
我用xaml为按钮s编写了简单的模板(用于silver light 4)SilverLight中的视觉状态?(我们如何使用它),silverlight,silverlight-4.0,controltemplate,visualstates,Silverlight,Silverlight 4.0,Controltemplate,Visualstates,我用xaml为按钮s编写了简单的模板(用于silver light 4) 所以当我尝试使用“ControlTemplate.Triggers”时,我发现这在silver light中是不可能的,我们必须在silver light中使用视觉状态 所以我写了第一个带有可视状态的ControlTemplate,但它不能正常工作 当我使用此样式并在此边框上移动此边框时,border和textbloc都不可见。所以 1) 我该怎么办? 2) 有没有关于视觉状态的好例子,因为有两个简单的错误u r st
所以当我尝试使用“ControlTemplate.Triggers”时,我发现这在silver light中是不可能的,我们必须在silver light中使用视觉状态
所以我写了第一个带有可视状态的ControlTemplate,但它不能正常工作
当我使用此样式并在此边框上移动此边框时,border和textbloc都不可见。所以1) 我该怎么办?
2) 有没有关于视觉状态的好例子,因为有两个简单的错误u r style不起作用,否则一切正常 1) 故事板.TargetProperty=“(Border.BorderBrush)。(SolidColorBrush.Color
}
它将是:
故事板.TargetProperty=“(Border.BorderBrush)。(SolidColorBrush.Color)
2) textblock也是如此:
故事板.TargetProperty=“(TextBlock.Foreground)。(SolidColorBrush.Color}
它将是:
故事板.TargetProperty=“(TextBlock.Foreground)。(SolidColorBrush.Color
)
我没有明白你的意思,你在创建模板/样式时是否遇到了一些问题?现在我只需使用Blend 3创建visual状态。要做到这一点,你应该知道如何使用Blend。这是学习Blend 3和visual状态的一个很好的例子:太愚蠢了!谢谢你的帮助。
有关于Blend 3和visual state的好文章吗VisualState据我所知,没有提供这么好的文章。但我会给你我的意见,我刚接触VisualState时做了些什么。只需安装ExpressionBlend-ExpressionBlend会自动为你生成所有vsm。然后只需编辑vsm,处理其属性,状态就可以了。这是一个很好的提示“ExpressionBlend”。我有,但我不知道如何使用它(特别是用于创建动画、效果和视觉状态)我怎样才能获得关于Blend 3的好指南。上面的链接帮助我开始使用Blend。它谈到了列表框的样式,这是一个最好的例子,你将涵盖所有的州。在抨击我的头后,我试图在Visual Studio中做设计和动画,我只是想给Blend增加一点重量Silverlight(特别是动画和设计)是为混合制作的。这是一个学习曲线,但绝对值得。
<Style x:Key="NextButtonStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid x:Name="MainGrid">
<Border x:Name="MainBorder"
BorderThickness="2"
BorderBrush="#FFC0C0C0"
Background="Bisque"
CornerRadius="4 4 4 4" >
<TextBlock x:Name="lbl"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Text=">"
Foreground="#FFC0C0C0"
FontWeight="Bold"
FontFamily="TimesNewRoman"
FontSize="15"/>
</Border>
<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="CommonStates">
<vsm:VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimationUsingKeyFrames AutoReverse="False" Duration="00:00:00.2"
Storyboard.TargetName="MainBorder"
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color}">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FF606060"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames AutoReverse="False" Duration="00:00:00.2"
Storyboard.TargetName="lbl"
Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color}">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FF606060"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>