Tuesday, April 16, 2013

Using Animated Gifs with WPF

Ever wish you could use an animated gif in your WPF application? Well, here is an easy way to do so. Simply use the WpfAnimatedGif Nuget package available on codeplex. With that library, you can easily display animated GIFs in your application via XAML or code.

Here is what the markup looks like…

 xmlns:a=http://wpfanimatedgif.codeplex.com





<Image a:ImageBehavior.AnimatedSource="Images/myImage.gif"/>


Head over to http://wpfanimatedgif.codeplex.com/ for more info.



Happy Coding!



Monday, April 15, 2013

Iterate through Dictionary Entries in Merged Dictionaries

Just a quick post to show you how to iterate through resource dictionary entries when using merged resource dictionaries. It is fairly straight forward. I came across someone wondering how to do this, so I thought I’d share. You simply iterate through all your merged dictionaries and then iterate through each dictionary entry in the dictionary. Here is the code below.

foreach (ResourceDictionary dict in Application.Current.Resources.MergedDictionaries)
{
foreach (DictionaryEntry entry in dict)
{
//Process entry

}
}



Hope this helps.



Monday, April 1, 2013

MessageDialog - Windows Store App MessageBox.Show Equivalent.

If you are new to Windows Store app development, you may be wondering how to show a simple dialog. It used to be so easy. You simply called MessageBox.Show() and you had a dialog. Well, in Windows Store Applications in Windows 8, it is a bit different but just as easy.

Try this code instead of MessageBox.Show to get the following dialog…

var messageDialog = new Windows.UI.Popups.MessageDialog("Message Text.","Message Header");
messageDialog.ShowAsync();


image


Happy Windows Store App Coding!