Reputation: 21
I am currently working on a Kiosk application in Silverlight 4. A user can add items to a cart and check out all using the Kiosk. When going from page to page I want to incorporate a button that has a blinking "outer glow", if you will, on the background of the button as well as the text of the button. I could do this with images but the text needs to be dynamic and I'd like to be able to create this as a template to be called on other buttons later on.
I wanted to start off by just trying to get the text blinking within my button.
<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>
As you can see, my Button.Content is a grid with 2 items in it. I have an Image and a TextBlock. The TextBlock should be controlled by my FlashMe storyboard but on the code behind, I get an error trying to use FlashMe.Begin(); It's almost like I'm not allowed to use a storyboard on the content of a button. Any ideas?
Any help is greatly appreciated, Thanks.
Upvotes: 2
Views: 1222
Reputation: 21
had something to do with the style. removed style, works fine. resolved.
Upvotes: 0