wpf-animation

WPF: Drag/Drop to re-order grid and jiggle

I need to implement a grid in WPF which has squares that can be dragged/dropped to be re-ordered, but I'm not sure the best way to do it. I was thinking using an ObservableCollection of squares and a UniFormGrid but although I have experience with both WPF and drag/drop, ideally I'd like to do a kind of 'jiggle' when before the user rele...

Starting an animation from the ViewModel in WPF/MVVM

I'm writing a MVVM app and have started putting in a few animations. I want to call something on the ViewModel which starts the a storyboard. This blog had a promising approach to it, but it doesn't actually work. The IDChanged handler never fires for some reason. I also found that you could start animations on EventTriggers, but I don'...

How to Animate a Gradient on a Path to visualize data flow in WPF/WCF app

I have an interesting project where several "nodes" on a cnavas are connected via a Path similiar to a mindmap tree. The path is used to visualize the connection state between two nodes. Red means the nodes are disconnected, green means they're connected. The next step would be to illustrate data flow (from A to B or B to A) using that p...

Animating WPF buttons from inside a style

Hello. I'm currently trying to make buttons on my forms animate using WPF - this is part of a University course, so it's all about demonstrating knowledge rather than looking good. We've been shown how to animate per-button, but since I want the animation to be the same on every button I'm using a style - something we've not been taugh...

What is the behavior of a WPF 4 ControlStoryboardAction trigger?

Hi all! I have a question that's been bugging me for a while: I have a lengthy IO operation which I invoke asynchronously, and I want my UI to show a blinking text to tell the users that the data is loading. I have an IsLoading boolean property in my ViewModel, and I used a ControlStoryboardAction to kickoff the blinking animation, wh...

How do I animate image content in WPF?

I have a really basic user control with a button that has an image. I want to animate the image of the button, by changing it to a different image. <UserControl.Resources> <Image x:Key="GlyphDefault" Source="pack://application:,,,/X;component/images/Glyphs_Default.png" Height="8" Width="8" /> <Image x:Key="GlyphClicked" Source=...

trouble animating GridLengths with star-values

Hi all. I'm using a third-party GridLengthAnimation class which is built to animate just like a DoubleAnimation class. I've used it many times before and it has never failed me - until now. I am trying to use it to expand/collapse part of my form based on the user checking a +/- checkbox to expand/collapse it. You know the drill. Th...

DoubleAnimation in ScaleTransform

I'm trying, as an exhibition, to use a DoubleAnimation on the ScaleX and ScaleY properties of a ScaleTransform. I have a rectangle (144x144) which I want to make rectangular over five seconds. My XAML: <Window x:Class="ScaleTransformTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http:/...

Create Bitmap from Collection of BitmapSources.

Hello I would like to create the Bitmap from BitmapSource Collection and Each source source should be one frame. I wrote the following code MemoryStream memStream = new MemoryStream(); BitmapEncoder enCoder = new GifBitmapEncoder(); foreach (BitmapSource source in BitmapSources) enCoder.Frames.Add(BitmapFrame.Create(source)); en...

Easing functions in WPF animation

Can you guys tell me is there any good, kind of a sample app where you can try all those easing functions with different parameters and see the changes? I mean there are two actual reasons why I can't built myself one: I simply don't have time I am a damn stupid indolent guy who needs to indulge his laziness ...

Why isn't this animation working?

I am learning WPF animation, and I created a simple demo app with a pretty straightforward animation. I have divided the main grid into three rows; a Buttons Row at the top, and two content rows that for the remainder of the screen, one red and one blue. Complete XAML is below. There are two buttons, Show Red and Show Blue. When each bu...

Run Animation when Dependency Property Changes

I have created a UserControl with two dependency properties: Value and Color. The Color of the UserControl is dependent on the Value property. For example if Value=0 Color=Blue, Value=0.5 Color=Red and so on. This I have achieved using a custom converter that is bound to the Fill property, like so: <Ellipse Name="dotForeground" Stroke="...

WPF Multiple DataTriggers targeting the same property with Animation

I have created a UserControl which is basically an Ellipse with a DependencyProperty called ValueH. The Fill property of the Ellipse is based on ValueH. So for example if ValueH=1 Fill=Red, ValueH=2 Fill=Blue, ValueH=3 Fill=Green and so on. I have also declared storyboards so that when the value of ValueH changes, a ColorAnimation is run...

How can I get the size of an autosized WPF Window?

I have a Window that is autosized around it's content. For an animation I'd need it's width and height. ActualWidth is always the max width of the window, Width and Height properties say NaN. ...

wpf animation events overlapping

I've got a canvas control that grows in height when you move the mouse over it and shrinks back on mouse leave. <Canvas x:Name="infoBar" Width="720" Height="39" Background="Red"> <Canvas.Triggers> <EventTrigger RoutedEvent="Canvas.MouseEnter"> <BeginStoryboard> <Sto...

Animating "this" and "other" in WPF

Consider following DataTemplate in any List Control: <DataTemplate> <TextBlock Text="{Binding}" /> </DataTemplate> and following animations: <Window.Resources> <Storyboard x:Key="animExpand"> <DoubleAnimation Storyboard.TargetProperty="Width" To="400" Duration="0:0:1" /> <DoubleAnimation Storyboard.TargetPrope...

I can't animate a custom property in WPF

I've been struggling with this for hours and I can't find out what I'm doing wrong. Please help me find my mistake. I created a user control with one custom dependency property and I want to animate this property. Here is my class: public partial class UserControl1 : UserControl { public UserControl1() { InitializeComp...

WPF DoubleAnimation does not decrease the value after an animation

Consider the following simple WPF form, we will try to animate border1's Height: This is the XAML for border1: <Border Margin="3" BorderBrush="Black" BorderThickness="1" Name="border1"> <Border.Style> <Style> <Setter Property="Control.Height" Value="50" /> <Style.Triggers> <DataTrig...

How to disable animation in WPF button

Hello, I have this WPF 4 code: <Button Content="{Binding Path=Header}" Command="{Binding Path=Command}" CommandParameter="{Binding Path=CommandParameter}" Focusable="False"> <Button.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="White" Offset="0"/> <Gradient...

How to make a background animation in WPF with forks to other animations when necessary?

I have a WPF application that I need to spruce up a bit with background animations similar to the background ‘flair’ that you see playing on a Tivo device (lights moving, balls rolling, etc…) or a DVD menu (where you can go in any direction from the menu). Depending upon the state of the application, I would want the background animatio...