0

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()
Do
'I split a gif into its individual frames and then load them sequentially
Me.Icon = Image.FromFile("Path\to\split\GIF\here") 
System.Threading.Thread.Sleep(250)
Loop
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?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by lxXTaCoXxl
0

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.

PSEUDO CODE:

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.