Hi guys, I want to add an animated taskbar icon to my WPF project. I figured I would just use the Icon property, but I'm fairly new to WPF, and I dont know how to do it. In Winforms I would create a thread like this:

Private Sub AniIcon()
'I split a gif into its individual frames and then load them sequentially
Me.Icon = Image.FromFile("Path\to\split\GIF\here") 
End Sub

But I can't find a Window.Dispatcher to use this approach in WPF. I also see something about "BeginAnimation" in the Icon Property?

So, what is the best way to do this?

Well I'm not too familiar with .NET but you can set up a timer component to call each frame of your animation. Just make sure each one is in the resources of your application.


If form1.icon = frame1.jpg Then
form1.icon = frame2.jpg
End If

Else If form1.icon = frame2.jpg Then
form1.icon = frame3.jpg
End If

Else If form1.icon = frame3.jpg Then
form1.icon = frame1.jpg
End If

This should be on a timer tick event, it's a pseudo code so you'll have to switch it up to the actual syntax. I'm not sure what it is in .NET I'm a C# and C++ programmer lol but the pseudo should help a little.