I have a WPF splash screen and I want to put an animated gif so I have used a winforms picturebox as explained here (WPF MediaElement is not working for me).
Below the code using winforms picturebox:
<Window x:Class="GifExample.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Loaded="Window_Loaded" >
<Grid>
<wfi:WindowsFormsHost>
<winForms:PictureBox x:Name="pictureBoxLoading">
</winForms:PictureBox>
</wfi:WindowsFormsHost>
</Grid>
</Window >
Now from WPF Window loaded event I am trying to set the image for winforms picturebox like in the link provided above:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
pictureBoxLoading.ImageLocation = "../Resources/mygif.gif";
}
My animated gif, "mygif.gif", is in the "Resources" folder of my splash screen project.
When I launch it, no image is shown in the picturebox instead it is show a white square with a red cross inside it.