What control type should I use - Image
, MediaElement
, etc.?
I, too, did a search and found several different solution in just a thread on the old MSDN forums. (link no longer worked so I removed it)
The simplest to execute seems to be to use a WinForms PictureBox
control, and went like this (changed a few things from the thread, most of it the same).
Add a reference to System.Windows.Forms
, WindowsFormsIntegration
, and System.Drawing
to your project first.
Then in the Window_Loaded
handler, you would set the pictureBoxLoading.ImageLocation
property to the image file path that you want to show.
private void Window_Loaded(object sender, RoutedEventArgs e)
{
pictureBoxLoading.ImageLocation = "../Images/mygif.gif";
}
The MediaElement
control was mentioned in that thread, but it is also mentioned that it is a rather heavy control, so there were a number of alternatives, including at least 2 homebrewed controls based on the Image
control, so this is the simplest.