WPF PNG image DPI

While wrestling with a problem of scaling a WPF window background image, I came across an issue which I had not thought about for ages.

The PNG had been created by a colleague and he set the image to 72dpi. 
It turns out the WPF defaults to 96dpi and therein lay the start of my problem.

Also part of my problem was that I was being a 'plank' as I had set ResizeMode to NoResize to prevent and user scaling the window and I had also set SizeToContent to Manual which screwed up the layout when the application was run. 
Although things looked great in the designer, the window rendering tries to re-calculate the layout of all the controls but the SizeToContent prevented the calculation to complete. The result being that the controls looked out of place in relation to the background image on  the window.

Add comment