.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

WPF Animation

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :WPF


I have been working on learning how to do Animation with WPF.  I have been working with one of the labs from the WPF training kit.  I can’t figure out why I am get an exception:

InvalidOperationException = ‘Storyboard1’ name cannot be found in the name scope of the ‘System.windows.Style’

Is it because of the inheritance used within the style, do I need to add something extra for this to work?

    <Style x:Key="absStyle">
        <Trigger Property="Control.IsMouseOver" Value="True">
          <Setter Property="Control.Foreground" Value="Red"/>
            <BeginStoryboard Name="Storyboard1">
              <Storyboard Duration="0:0:1">
                <DoubleAnimation Storyboard.TargetProperty="FontSize" To="20"/>
                <ThicknessAnimation Storyboard.TargetProperty="Margin" To="26,118,45,104"/>
                <DoubleAnimation Storyboard.TargetProperty="Width" To="210"/>
                <DoubleAnimation Storyboard.TargetProperty="Height" To="40"

View Complete Post

More Related Resource Links

Silverlight Simple Animation

Silverlight has several built in techniques for animating controls. Many of these technologies are particularly useful for creating simple animations meant to decorate a web page with eye catching movement that draws the reader's attention. In this post I will skip over these decorative technologies, and instead show how to create a simple animation using a technique similar to those used in many games.

Animation Extender ( LinkButton Disbale )


My flyout animation starts on a click of linkbutton, everything works fine on IE, as I click the linkbutton flyout animation is triggered and linkbutton gets disbaled during the animation. But on Firefox and Chorme linkbutton doesn't get disbaled , due which if I again and again click on the linkbutton the flyout animation keeps moving towards left side on every click.

In firefox and chorme linkbutton always remains enabled.

 <cc1:AnimationExtender ID="AnimationExtender1" TargetControlID="lnkBtnAbt" runat="server">
                        <EnableAction Enabled="false" />
                        <StyleAction AnimationTarget="moveMe" Attribute="display" Value="block"/>
                        <Parallel AnimationTarget="moveMe" Duration=".5" Fps="30">
                            <Move Horizontal="-350" Vertical="50"></Move>
                            <FadeIn Duration=".5"/>
                        <Parallel AnimationTarget="moveMe" Duration=".5">

Foundations: Extending the WPF Animation Classes


Learn what the WPF Animation Classes can do, what they can't, and how to extend them.

Charles Petzold

MSDN Magazine July 2007

DirectX 8.0: Enhancing Real-Time Character Animation with Matrix Palette Skinning and Vertex Shaders


DirectX 8.0 allows the creation of smooth and realistic character movements that are more life-like than simple articulated structure animations. This is made possible by its improved support for vertex tweening and blended vertex deformations, also known as soft-skinning. After a brief history of the use of these techniques in DirectX, soft-skinning using the fixed function pipeline is discussed. This is followed by the use of matrix palettes from within vertex shaders to create a customized soft-skinning solution that takes advantage of the benefits of vertex shaders, such as hardware acceleration and custom lighting algorithms without the limitations of fixed-function solutions.

Benjamin Freidlin

MSDN Magazine June 2001

MVVM and Animation Control

I've been struggling with what should be a fairly straightforward issue...hoping someone's got a solution.I'm using MVVM in a scenario where I'm using a MediaElement in a View. The MediaElement has a Storyboard that I customize using DataBinding. The scenario works well when I'm using EventTriggers to control playback, but I have not discovered how to manipulate things using DataTriggers.My Storyboard consists of a ParallelTimeline, which contains the MediaTimeline (with Source, BeginTime and Duration databound to the ViewModel. I've got two buttons that are attached to the Storyboard in EventTriggers calling PauseStoryboard and ResumeStoryboard. This works well, but it's not the best paradigm for me.I am trying to accomplish a design where, if I have two such Views each containing a MediaElement with this type of Storyboard, when one Storyboard reaches its end point, the other View's MediaElement is triggered to play.I have tried to use a DataTrigger design, but I am having problems freezing the Storyboard because I'm using DataBinding to set some of the Storyboard parameters.Does anyone have any ideas as to how I can control a MediaElement via Storyboard/Timeline using DataTrigger instead of EventTrigger? Am I missing something obvious in MVVM?--- Jim ---

animation ajax control

hi , how I do like this http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/Animation/Animation.aspx the first exemple

StopStoryboard fails to stop an animation

I have a textbox style that sets the Template property in order to add an animated watermark: <Style TargetType="{x:Type TextBox}">     <Setter Property="Template">         <Setter.Value>             <ControlTemplate TargetType="{x:Type TextBox}">                 <Border BorderBrush="{TemplateBinding BorderBrush}"                         BorderThickness="{TemplateBinding BorderThickness}"                         Padding="{TemplateBinding Padding}">                     <Grid>                         <AdornerDecorator Name="PART_ContentHost" />                   &

How to I apply an XAML declared animation to multiple controls dynamically?

Hello, How to I apply an XAML declared animation to multiple controls dynamically? Here is the XAML declared animation: <Window.Resources> <Storyboard x:Key="TextBlock_SB"> <DoubleAnimation Storyboard.TargetName="TextBlock_1" Storyboard.TargetProperty="(TextBlock.Opacity)" From="1.0" To="0.75" Duration="0:0:0.5" AutoReverse="True" RepeatBehavior="Forever" /> </Storyboard> Here is the code that starts the animation for TextBlock_1: (this.Resources["TextBlock_SB"] as Storyboard).Begin(); I want to apply the same storyboard/animation to TextBlock_2 and TextBlock_3 and perhaps others.  How do I do that without defining more XAML storyboards? Regards, Robert  

Update progress animation

I have an update progress control that I use to overlay an updatepanel. It has an animated gif that is displayed. The animated gif doesn't not work though unless I add system.threading.thread.sleep([seconds]) . Obviously I don't want to do that. Is there something I need to do to get the gif to work or is it just the nature of the beast? Here is the code for the update progress. It is triggered by an update panel that has a control that updates another update panel. <asp:UpdateProgress id="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel2" DisplayAfter="1"> <progresstemplate> <DIV class="LoadingOverlay"></DIV> <DIV class="LoadingMessage">Loading...<BR /><IMG src="../../../helpdesk/img/progress.gif" /> </DIV> </progresstemplate> </asp:UpdateProgress>  

VisualStateManager: change a property before it starts animation?

i realize that if we "animate" the Visibility property.. it uses the ObjectAnimationUsingKeyFrames animation to set the property after it transits to a new state... how can i change the property before it animates in the new state? i know there is the CurrentStateChanged and CurrentStateChanging event that i can use to set the property.. however... that is ok if you have 2 states.. but for my case i have a couple of states(in my case 7 states)... so if change the visibility in one of the states... the property doesn't switch back automatically when we switched to another state.... my thought of having 7 conditions to change the property just isn't the right way of doing... maybe.... it would be good if the VisualStateManager provides an attachedproperty to set on the specific ObjectAnimationUsingKeyframes to indicate whether the animation property is to be set at the start or at the end of the animation thanks

Animation on the button click event???

hi, I have prepared a wpf application with 3 buttons. namely: start configure and manual now i want when initially the form loads the only start button should be visible. well not a big task at all!!! i have done it   but:   now i want to make the other two buttons visible and the start button invisible with a bit of animation on the button click event associated with "start" button.   Can any one plz suggest how should i proceed on with??? And ya am using c# for programming the application.....

Can animation extender be used to replicate Twitter's smooth-scrolling, latest-tweet control?

I'm not going for the exact same control, but if I can find a smart way to automatically/smoothly scroll through text from the database on Timer Tick intervals of 5 seconds... then I can use that as a template. My main idea would be to just dynamically create panels with the text inside of them, then dispose of them when they come towards the bottom of the list... but 3 things stop me 1) it would be a lot of work, 2) when the last panel cycles to the bottom of the display area then how do I make it smoothly disappear? 3) What would I use for the display spot?- a Panel won't work because if its contents exceed the set height, it either just expands to fit it or adds scroll bars. I basically want it to have slideshow functionallity how the images smoothly scroll every few seconds (without the scroll bar), and instead of images I want to use text. Any ideas?

Report Loading animation

Hi all, Is it possible to change the report loading green doughnut to be another animated graphic?  If so how? Thanks! Ash

Colapsable Panel Animation

 Hello, Someone knows a way to block/disable the Animation of ColapsablePanel on Colapse/Expand? I am having problems of performance/stucks of the page on colapse or expand a panel. Thanks!

How to rotate a Path by an animation?

Hi! I want to rotate a Path in a DoubleAnimation, but following code does'nt works, what's the problem? Thanks! RotateTransform transform = new RotateTransform(); transform.Angle = 0; p.RenderTransform = transform; // p is a Path DoubleAnimation animation = new DoubleAnimation(); animation.From =transform.Angle; animation.To = transform.Angle + 90; animation.By = 1; animation.Duration = new Duration(TimeSpan.FromSeconds(2)); Storyboard.SetTarget(animation, transform); Storyboard.SetTargetProperty(animation, new PropertyPath(RotateTransform.AngleProperty)); Storyboard story = new Storyboard(); story.Duration = animation.Duration; story.Children.Add(animation); story.Begin();

Animation sample and basic XAML question.

I am trying to put into place the animation sample in http://msdn.microsoft.com/en-us/library/system.windows.media.animation.stringkeyframe.keytime.aspx It doesn't work. I have two questions. 1) The example lists both the XAML and the C# code. It doesn't seem that the two are tied together. In this example is the XAML and C# code just two ways of obtaining the same result? 2) When the Rectangle is constructed in the C# code the properties set and the delegate event 'Loaded' asssigned. How is this event triggered? Just for learning purposes I would like to have this rectangle move across the bounds of the application window when triggered and stop again under user control. I am not sure how to construct the restangle then have it tied to my main window. Thank you. Kevin

4 stage animation

I need to create an animation which consists of 4 stages. I have done something like that in WinForms with my own classes. I want to port proj to WPF. 1 fade in 2 stayVisible 3 fadeOut 4 stayInvisible   The result is a slideshow. I need the animation to loop forever and change the image at each cycle. How Should I stack Animations? Is there a declarative way? Or should I use Completed event?   By the way I need to be able to change the Duration of individual stages(animations)   .NET guy
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend