I'm developing an application that needs to be resolution independent. The application will always be full screen so I have to design my UI so that the monitor resolution will not impair the use of the application. I've been spending a good amount of time playing around with WPF trying to accomplish this. Today I found out about the Viewbox. It seems to solve all my problems. All I have to do is place the Grids used to layout each screen in Viewboxes and like magic I have a resolution independent application.
However, this just seems to easy. It doesn't feel right. Should I be using Viewboxes? If not what should I do instead? Before I found out about the Viewbox I was having difficulty coming up with a way to scale the font sizes with respect to resolution. With a Viewbox I don't have to worry about this. So if a Viewbox is the wrong thing to use, how do I go about resizing my text?
WPF has resolution independence at its core. Its default measurement is in Device Independent Pixels (DIPs), not pixels. Can you explain how this is not working for you, and perhaps provide a very simple example of XAML that is not scaling correctly?
Actually, you're quite right. WPF IS resolution independent, but the problem is how you control font sizing.
ViewBoxes should be avoided, because they cost performance, but I think a single one shouldn't hurt anybody.
But beware: It may look right now, but you simply can't display as much information with 640x480 as with 1600x1200... The most elegant solution is to use resolution dependent templates which are demonstratet in the Photo Suru app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With