#24 – Don’t Use Bitmaps in WPF Applications

Because WPF is able to scale your application based on the system DPI, you should avoid using bitmaps in your application.  Instead, you should render all controls, e.g. buttons on a toolbar, with vector graphics so that they can be scaled larger/smaller and still look correct.

The hardest part of this process will be finding vector-based graphical images to use in your application and then converting them to XAML so that you can use them in your WPF project.

Mike Swanson has written a plug-in for Adobe Illustrator that allows exporting vector-based images to XAML (which you can then import directly into a WPF project).  There’s also a good writeup explaining the process here.

Here’s an example, showing an image of the Earth that scales when the application window scales.

Advertisement