« Binding a table in a FlowDocument | Main | Extracting thumbnails from a JPEG/JPG in .NET 3.0 »

Photoscroll -- the worst named WPF demo application with source code!

With the exception of this project being called, WindowsApplication72, I'll admit that this is one of the poorest named projects I've distributed. I could have changed the name, but since it's really more of a demo right now than any truly useful functionality, I decided to not bother.

The intention of Photoscroll is to demonstrate a number of useful features in WPF -- and to show off some of the simple things that can be done with WPF that you may not have ever thought of including in an application if you weren't using WPF.

The application code written in C# is available for download below. You might be curious what the application looks like:

Cool animations when images are loading -- no 'jerky' or hanging user interface as the images load.

Tooltips on steroids -- with a Vista like glass effect (that works on XP).

Intermediate images shown while the full size image is loaded...

It uses the WIC BitmapMetadata (Windows Imaging Component) classes to extract available meta data from photos (and show it in a geeky, here's all the raw info available way):

If you have any questions about the code, feel free to send me an e-mail (coder@ this website).

Download (C#/.NET 3.0 required)

Due to the large size of the final EXE (as it contains quite a few graphics), you'll need to build the project to run it as I've excluded it from the download.

I'll be posting some details about the code very soon.

Here are some of the .NET 3.0 classes/properties that the sample code uses:

  • BitmapMetadata (ContainsQuery and GetQuery)
  • IValueConverters
  • Dispatcher
  • Binding
  • VirtualizingStackPanel
  • RoutedCommands
  • Table (and binding to a FlowDocument)
  • BitmapImage
  • BitmapDecoders and BitmapFrame
  • DoubleAnimation
  • DiscreteObjectKeyFrame
  • ControlTemplate
  • DataTrigger
  • Style
  • Trigger EnterAction ExitAction
  • Drag and Drop DataFormats.FileDrop
  • VisualBrush Visual
  • Thumbnail
  • Tooltip

Although I've put a copyright notice and warning on much of the code, all that I really want is a thank-you e-mail/post and a link to my website if you use the code. :)


GlassBkgnd.png is missing from the project so it does not compile well.

Try downloading again. I'm not sure where you see that -- maybe it was in an older version temporarily. It's definitely not in the project anymore so I've uploaded a new copy.

Thanks Aaron, this is exactly the solution I was looking for. Awesome work!

So I tested, but I'm very suprised of how much RAM is consumed for this 'little' app, which seems being very good coded...but is there something you forgot about the performance ? Although you used the BitmapSource to load the pics, it's eating about 200 Megs of memory when in execution !!! For example, if I scroll to the extreme right of the thumbnails bar, load the picture by clicking on it and scroll rapidly to the extreme left of the scrollbar, it reloads all the thumbnails for the display...in you opinion, is the Garbage Collector not doing his job or is there any solution for this ?

Hi Paul -- .NET apps often use a lot of RAM -- especially when it's available. The garbage collector won't work very hard if there's extra RAM to use -- which can boost performance. I don't know how long you waited, or how many pictures you're showing on the screen, whether the images had thumbnails, ... For an imaging app to use 200MB, I'm not too shocked at all. If it goes beyond that, I could see there might be a problem.

Hi, I just discovered your blog from the WPF forums.

Despite the name ;-), this seems like a very cool, jam-packed demo. I need to download and check it out.

It looks great :)
Really cool~~~

I just wanted to thank you for the sample application. It allowed me to understand how to decode images using memory streams. Thanks again and keep up the blogging, they're great.

Help support my web site by searching and buying through Amazon.com (in assocation with Amazon.com).