The app now has two tracks running in the background: the sound of the ocean and some nice calm music. When you move items in the Panel3D, it plays a subtle sound that makes it feel like something physical is happening. Also, when you open a blogger’s bio or blog, it plays a sound that represents a Web browser being opened. I spent a while picking out the right sounds, and adjusting the volume levels so that they are not tacky. Hopefully my tastes are good!
The one interesting part about how this works is the way that the sound plays when you move items in the panel. Here is the way I achieved that in XAML:
That snippet takes advantage of the fact that Panel3D has an IsItemsMoving dependency property that is set to true when you call MoveItems() and is set to false when the call completes later on. For this trick to work, the MediaElement’s DataContext must be set to the Panel3D instance so that it can bind to the panel correctly.
If my audio files were .WAV files, instead of .MP3, I could have used the SoundPlayerAction instead of this tricky approach.
Here is a video showing this app in action, in case you do not have Visual Studio 2008 or .NET Framework 3.5 installed:
Download the source code here: WPF Disciples 3D Blogroll Viewer with Audio (source code)
Download the executable here: WPF Disciples 3D Blogroll Viewer with Audio (binaries)
NOTE: Be sure to change the file extension from .DOC to .ZIP and then decompress the file. This is a workaround for a limitation imposed by WordPress.