coding4beer
coding4beer

Reputation: 115

How to determine that UserControl has been loaded completely?

How to determine that UserControl has been loaded completely?

I have some UserControls with images and media files from another server bound like that:

<Image Source="{Binding Image}" />

I would like to know when all my images are downloaded and ready to be shown. I've noticed an event ImageLoaded, and probably I can listen to it on all of my Image controls. Isn't there a better way to do that?

Upvotes: 0

Views: 616

Answers (1)

Maciek
Maciek

Reputation: 19893

The class FrameworkElement contains a public event called "Loaded", so naturally all classes derviving from it (UserControl class) expose it as well.

MSDN

The question would be : Are you downloading your images ? (This can be after loading of the control Check here) Or are you embedding your images in the project? They'll be a part of the .xap file that's downloaded when you launch your application.

You can add an event handler to that event to execute code when the said event occurrs. Hope that helps.

Upvotes: 2

Related Questions