![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Trigger Storyboard from c# code Hello everybody, I'm currently using a template for a button that triggers a storyboard animation when moving the mouse over the button. The template looks basically like this: .... <ControlTemplate x:Key="GlassButton" TargetType="{x:Type Button}"> <ControlTemplate.Resources> <Storyboard x:Key="Timeline1" x:Name="Timeline1"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </ControlTemplate.Resources> <Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" Grid.RowSpan="2" CornerRadius="4,4,4,4"> .... Now I want to trigger the storyboard animation from the c# code as well. I tried something like Object o = myButton.FindResource("Timeline1"); myButton.BeginStoryboard((Storyboard)o); however, this throws an InvalidOperationException pointing out that "'glow' name cannot be found in the name scope of 'System.Windows.Controls.Button'". What do I do wrong? Thanks in advance Timmy |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to Trigger Data Binding to Method | Runar Jordahl | Avalon | 5 | 10-17-2007 07:24 PM |
| How do you trigger MCE in Vista Ultimate? | MrMikeH | Vista music pictures video | 1 | 01-19-2007 02:39 PM |
| trigger for IsFocused - not working? | CosminB [BRT] | Avalon | 0 | 04-22-2006 02:00 AM |
| Can trigger work outside a style ? | Philippe Lavoie | Avalon | 1 | 03-15-2006 10:21 PM |
| databinding trigger | Arnaud Fontaine | Avalon | 4 | 01-31-2006 06:59 AM |