2
我目前正在Silverlight 4中的Kiosk应用程序中工作。用户可以将项目添加到购物车并使用Kiosk检出所有项目。当从一个页面到另一个页面时,我想要合并一个闪烁的“外部辉光”的按钮,如果您愿意的话,在按钮的背景上以及按钮的文本中。我可以用图像做到这一点,但文本需要动态,我希望能够创建这个模板作为模板以后在其他按钮上调用。Silverlight 4中的TextBlock.Text闪烁按钮
我想开始时只是想让文本在我的按钮内闪烁。
<Button Name="AddItemButton" Height="110" Click="AddItemButton_Click" Visibility="Collapsed"
Grid.Row="4" VerticalAlignment="Top" Style="{StaticResource ButtonRound1}">
<Button.Resources>
<Storyboard x:Name="FlashMe">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="AddItemButtonTextBlock">
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Button.Resources>
<Grid>
<Image Source="Images/bg-greengradient.png" Stretch="Fill"/>
<TextBlock x:Name="AddItemButtonTextBlock" Text="Add Item" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</Button>
正如你所看到的,我的Button.Content是一个包含2个项目的网格。我有一个图像和一个TextBlock。 TextBlock应该由我的FlashMe storyboard控制,但是在后面的代码中,我尝试使用FlashMe.Begin()时出错。这几乎就像我不允许在按钮的内容上使用故事板。有任何想法吗?
任何帮助,非常感谢,谢谢。
你会得到什么错误?特别? – Nate
删除了FlashMe.Begin()后面的codeb;但仍然收到错误System.ArgumentException:值不在预期范围内。 – PatTheDeveloper
如果它只是上面的代码没有任何代码后面应该工作正常,错误必须来自别的东西。 –