Shakir Ahmed
Shakir Ahmed

Reputation: 547

How to Animate the GridViewItem Image just like the Microsoft Groove Music

I am developing a music player. In the Albums page, I show all the albums in a GridView. While panning, the image of the GridViewItem changes a bit later after reaching a certain position. It happens because of the virtualization and caching mode. I want to animate the opacity of the image while changing so that the user won't see the last image that was in that GridViewItem just like the Groove Music. How can I achieve that? Should I create or add DataTemplate programmatically while panning in the event called *ContainerContentChanging OR *ChoosingItemContainer ? Just give me a reference or hint.

Upvotes: 0

Views: 43

Answers (1)

Anran Zhang
Anran Zhang

Reputation: 7727

If you want a gradual effect when the image is loaded, there is a control ImageEx in WindowsCommunityToolkit that can help you.

You can directly reference the control. When ImageEx.Source changes, the state changes internally.

It creates a Storyboard to control the Opacity of the image from 0 to 1.

Upvotes: 1

Related Questions