Received the exception below when trying to create a simple splash screen. Not sure if I am missing something, but I basically copied the markup provided in the intro. Markup and exception are included.
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '9' and line position '10'.
<Window x:Class="DemoApp.SplashScreen"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
Title="SplashScreen" Height="300" Width="300"
ResizeMode="NoResize" WindowStyle="None"
WindowStartupLocation="CenterScreen" Background="white" BorderThickness="5" BorderBrush="LightGray" Topmost="True">
<Grid Height="290" VerticalAlignment="Top">
<Image gif:ImageBehavior.AnimatedSource="Images/loading.gif" />
</Grid>
</Window>
It was not but I changed it to that and the error no longer shows up. Thanks!
The only issue now is that the gif does not play, but I am wondering if it is because of where in my code that I am instantiating my custom splash screen.
public MainWindow()
var splashScreen = new SplashScreen();
splashScreen.Show();
//Initialize Components
splashScreen.Close();
The splash screen and gif image show up, but the gif does not play.
That's because the UI thread is busy doing the "Initialize components" stuff, so it cannot paint your splash screen. In fact, this problem isn't even related to WpfAnimatedGif; if you add a button or some other interactive UI component to your splash screen, you'll see that's it doesn't respond to input.